package stsj.meddroid.screen;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import stsj.meddroid.MainAppListener;
import stsj.meddroid.Resources;
import stsj.meddroid.Settings;
import stsj.meddroid.elements.BlueRepetol;
import stsj.meddroid.elements.BlueSlime;
import stsj.meddroid.elements.BoguriChieftain;
import stsj.meddroid.elements.BoguriWarrior;
import stsj.meddroid.elements.Enemy;
import stsj.meddroid.elements.GomuGomu;
import stsj.meddroid.elements.GomuKing;
import stsj.meddroid.elements.GreenSlime;
import stsj.meddroid.elements.HTN;
import stsj.meddroid.elements.InsaneBoguri;
import stsj.meddroid.elements.LittleGomu;
import stsj.meddroid.elements.MedDroid;
import stsj.meddroid.elements.OrangeSlime;
import stsj.meddroid.elements.Orb;
import stsj.meddroid.elements.Organ;
import stsj.meddroid.elements.RBJ;
import stsj.meddroid.elements.RedRepetol;
import stsj.meddroid.elements.RedSlime;
import stsj.meddroid.elements.SMC;
import stsj.meddroid.elements.SPT;
import stsj.meddroid.elements.Time;
import stsj.meddroid.elements.Vaccine;
import stsj.meddroid.elements.VioletRepetol;

import android.text.style.SuperscriptSpan;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actors.Button;
import com.badlogic.gdx.scenes.scene2d.actors.Image;
import com.badlogic.gdx.scenes.scene2d.actors.Button.ClickListener;

public class BattleScreen implements Screen, InputProcessor {

	private MainAppListener mainListener;
	public Screen lastScreen;

	private int stageNumber;
	private int roundNumber;

	private Camera camera;

	private int counter = 0;
	private Color defaultColor;
	private float rotationDegree;
	
	private boolean paused = false;

	// menu dialog

	private boolean battleMenuShow = false;
	private Stage battleDialog;
	private Image bgBattleDialog;
	private Button retryButton;
	private Button returnPlayButton;
	private Button helpButton;
	private Button mainMenuButton;
	private Button soundButtonOn2;
	private Button soundButtonOff2;

	// help dialog
	public boolean helpDialogShow = false;
	private int currentScene;
	private static final int numberScenes = 5;

	// win dialog
	private Stage winDialog;
	private Button nextRoundButton;
	private Image bgWinDialog;
	private boolean winDialogShow;

	// failed dialog
	private Stage failedDialog;
	private Image bgFailedDialog;
	private boolean failedDialogShow;

	// --
	private static final int x0 = Gdx.graphics.getWidth() / 2 - 240;
	private static final int y0 = Gdx.graphics.getHeight() / 2 - 160;

	public static boolean unlockRedSlime = false;
	public static boolean unlockGreenSlime = false;
	public static boolean unlockBlueSlime = false;
	public static boolean unlockOrangeSlime = false;
	public static boolean unlockLittleGomu = false;
	public static boolean unlockGomuGomu = false;
	public static boolean unlockGomuKing = false;
	public static boolean unlockBoguriWarrior = false;
	public static boolean unlockBoguriChieftain = false;
	public static boolean unlockInsaneBoguri = false;
	public static boolean unlockBlueRepetol = false;
	public static boolean unlockRedRepetol = false;
	public static boolean unlockVioletRepetol = false;
	public static boolean unlockHTN = false;
	public static boolean unlockSPT = false;
	public static boolean unlockRBJ = false;
	public static boolean unlockSMC = false;

	// ---------------------------------------------
//	public static final int LEFT = 1; // MedDroid medDroid.face
//	public static final int RIGHT = 2; // MedDroid medDroid.face
//	public static final int FRONT = 0; // MedDroid medDroid.face
//	public static final int NORMAL = 0; // MedDroid medDroid.getState()
//	public static final int BALL = 1; // MedDroid medDroid.getState()
//	public static final int SLEEP = 2; // MedDroid medDroid.getState()
//	public static final int PUNCH = 3; // MedDroid medDroid.getState()
//	public static final int LASER = 4; // MedDroid medDroid.getState()
//	public static final int MOVE = 5; // MedDroid medDroid.getState()
//	public static final int SPECIAL = 6; // MedDroid medDroid.getState()
//	public static final int SPECIALREADY = 7; // MedDroid medDroid.getState()
//	public static final int DOSPECIAL = 8; // MedDroid medDroid.getState()
//	public static final int EAT = 9; // MedDroid medDroid.getState()
//	public static final int DAMAGE = 10; // MedDroid medDroid.getState()
//	
	public static final int LEFT = 1; // MedDroid medDroid.getFace()
	public static final int RIGHT = 2; // MedDroid medDroid.getFace()
	public static final int FRONT = 0; // MedDroid medDroid.getFace()
	
	public static final int NORMAL = 0; // MedDroid medDroid.getState()
	public static final int BALL = 1; // MedDroid medDroid.getState()
	public static final int SLEEP = 2; // MedDroid medDroid.getState()
	public static final int PUNCH = 3; // MedDroid medDroid.getState()
	public static final int LASER = 4; // MedDroid medDroid.getState()
	public static final int MOVE = 5; // MedDroid medDroid.getState()
	public static final int SPECIAL = 6; // MedDroid medDroid.getState()
	public static final int SPECIALREADY = 7; // MedDroid medDroid.getState()
	public static final int DOSPECIAL = 8; // MedDroid medDroid.getState()
	public static final int DAMAGE = 9; // MedDroid medDroid.getState()
	public static final int SHIELD = 10; // MedDroid medDroid.getState()
	public static final int INVISIBLE = 11; // MedDroid medDroid.getState()
	public static final int BELUMTAHU = 12; // MedDroid medDroid.getState()
	public static final int IMPERIAL = 13; // MedDroid medDroid.getState()
	
	
	private int animationTimePunch;
	private int animationTimeMove;
	public static int plusSpecial;
	public static int plusPunch;
	public static int plusLaser;
	private SpriteBatch batch;
	
	private Texture texB;
	private Texture texLaser;
	

	
	
	private TextureRegion texBrain;
	private TextureRegion texKidney;
	private TextureRegion texLiver;
	private TextureRegion texLung;

	private Texture texTime;

//	public static TextureRegion texBlueSlime;
//	public static TextureRegion texGreenSlime;
//	public static TextureRegion texOrangeSlime;
//	public static TextureRegion texRedSlime;
//	public static TextureRegion texLittleGomu;
//	public static TextureRegion texGomuGomu;
//	public static TextureRegion texGomuKing;
//	public static TextureRegion texBoguriWarrior;
//	public static TextureRegion texBoguriChieftain;
//	public static TextureRegion texInsaneBoguri;
//	public static TextureRegion texBlueRepetol;
//	public static TextureRegion texRedRepetol;
//	public static TextureRegion texVioletRepetol;
//	
//	public static TextureRegion texImmunity;
	public static Texture texImmunity;
	
	
	public static Texture texBlueSlime;
	public static Texture texGreenSlime;
	public static Texture texOrangeSlime;
	public static Texture texRedSlime;
	public static Texture texLittleGomu;
	public static Texture texGomuGomu;
	public static Texture texGomuKing;
	public static Texture texBoguriWarrior;
	public static Texture texBoguriChieftain;
	public static Texture texInsaneBoguri;
	public static Texture texBlueRepetol;
	public static Texture texRedRepetol;
	public static Texture texVioletRepetol;
	
	public static Texture texBlack;
	public static Texture texBlack2;
	public static Texture texBlack3;
	public static Texture texBlack4;
	
	

	private Sprite sprite;
	private Sprite sprite2;
	private Sprite spriteLaser;
	private Sprite spriteLight;
	private Sprite spriteSpecialButton;
	private Sprite spriteModeButton;
	private Sprite spriteHealth;
	private Sprite spriteBar;
	private Sprite spriteEnergy;
	private Sprite spriteBar2;
	private Sprite spriteTime1;
	private Sprite spriteTime2;
	private Sprite spriteTime3;
	private Sprite spriteTime4;
	private Sprite spriteCountEnemies1;
	private Sprite spriteCountEnemies2;
	private Sprite spriteCountVaccine1;
	private Sprite spriteCountVaccine2;
	private Sprite spriteMinuteSecond;
	private Sprite spriteKidney1;
	private Sprite spriteKidney2;
	private Sprite spriteLiver;
	private Sprite spriteBrain;
	private Sprite spriteLung;
	private Sprite spriteImmunIcon;
	private Sprite spriteViroIcon;

	public static Pixmap arena;
	public static int resolutionProblemSolver;

	private int tesRound = 1;
	private int regen;
	private int counterSpriteOrgan;
	private int accelX;
	private int accelY;
	private int accelZ;
	private double azimuth;
	private int score;
	private int secondLimit;
	private int minuteLimit;
	private boolean bool;
	public boolean passingWin;
	public boolean passingLose;
	public static int centerX;
	public static int centerY;

	public static MedDroid medDroid;
	public static Organ brain;
	public static Organ liver;
	public static Organ kidney1;
	public static Organ kidney2;
	public static Organ lung;
	public static Time roundTime;

	// Round dan isi Field
	public static HashMap<Enemy, Boolean> listOfEnemies;
	public static List<Vaccine> listOfVaccines;
	public static List<Orb> listOfOrb;
	public static List<Enemy> listOfEnemies2;

	// --------------------------------
	private boolean initialized = false;
	
	private boolean completedSound = false;
	
	private TextureRegion punchRegion;
	private TextureRegion shieldOnRegion;
	private TextureRegion shieldOffRegion;
	private TextureRegion invisOnRegion;
	private TextureRegion invisOffRegion;
	private TextureRegion imperialRegion;
	private TextureRegion laserRegion;
	

	public  TextureRegion battleDialogReg;
	public  TextureRegion winDialogReg;
	public  TextureRegion failedDialogReg;

	public  TextureRegion[] helpButtonReg;
	public  TextureRegion[] retryButtonReg;
	public  TextureRegion[] returnPlayButtonReg;
	public  TextureRegion[] mainMenuButtonReg;
	
	
	public  TextureRegion[] nextRoundButtonReg ;
	
	
	public void initResources() {



		texBrain = new TextureRegion(Resources.organmenulayout,0,0,341,256);
		texKidney = new TextureRegion(Resources.organmenulayout,0,256*2 + 512,128,256);
		texLiver  = new TextureRegion(Resources.organmenulayout,0,256 + 512,256,256);
		texLung  = new TextureRegion(Resources.organmenulayout,0,256,341,512);
		
		// Battle Menu Resources
	
		

		battleDialogReg = new TextureRegion(Resources.playerdialog, 256*3, 256, 256, 128);
		winDialogReg = new TextureRegion(Resources.playerdialog, 0, 256, 256, 128);
		failedDialogReg = new TextureRegion(Resources.playerdialog, 256*2, 256, 256, 128);
		
		helpButtonReg = new TextureRegion[2];
		helpButtonReg[0] = new TextureRegion(Resources.buttonDll, 64*7, 64, 32, 32);
		helpButtonReg[1] = new TextureRegion(Resources.buttonDll, 64*7+32, 64, 32, 32);
		retryButtonReg = new TextureRegion[2];
		retryButtonReg[0] = new TextureRegion(Resources.buttonDll, 64*7, 64*2, 32, 32);
		retryButtonReg[1] = new TextureRegion(Resources.buttonDll, 64*7+32, 64*2, 32, 32);
		returnPlayButtonReg = new TextureRegion[2];
		returnPlayButtonReg[0] = new TextureRegion(Resources.buttonDll, 64*6, 64+32, 32,
				32);
		returnPlayButtonReg[1] = new TextureRegion(Resources.buttonDll, 64*6+32, 64+32, 32,
				32);
		mainMenuButtonReg = new TextureRegion[2];
		mainMenuButtonReg[0] = new TextureRegion(Resources.buttonDll, 64*7, 64+32, 32, 32);
		mainMenuButtonReg[1] = new TextureRegion(Resources.buttonDll, 64*7+32, 64+32, 32, 32);
		
		nextRoundButtonReg = new TextureRegion[2];
		nextRoundButtonReg[0] = new TextureRegion(Resources.buttonDll, 64*6, 64*2, 32, 32);
		nextRoundButtonReg[1] = new TextureRegion(Resources.buttonDll, 64*6+32, 64*2, 32, 32);

		
		
		Gdx.app.log("Init battle", "Mulai");
		
		battleDialog = new Stage(480, 320, true);
		
		battleDialog = new Stage(480, 320, true);
		bgBattleDialog = new Image("dialog box menu", battleDialogReg);
		retryButton = new Button("Retry ButtonReg", retryButtonReg[0],
				retryButtonReg[1]);
		returnPlayButton = new Button("Return play ButtonReg",
				returnPlayButtonReg[0], returnPlayButtonReg[1]);
		helpButton = new Button("Help ButtonReg", helpButtonReg[0],
				helpButtonReg[1]);
		mainMenuButton = new Button("Main menu ButtonReg",
				mainMenuButtonReg[0], mainMenuButtonReg[1]);
		soundButtonOn2 = new Button("SoundOn2", Resources.soundRegion[0],
				Resources.soundRegion[1]);
		soundButtonOff2 = new Button("SoundOff2", Resources.soundRegion[1],
				Resources.soundRegion[0]);

		bgBattleDialog.x = battleDialog.width() * 0.25f;
		bgBattleDialog.y = battleDialog.height() / 2 - 60;

		helpButton.x = bgBattleDialog.x + bgBattleDialog.width / 4 + 20;
		helpButton.y = bgBattleDialog.y + 20;

		soundButtonOn2.scaleX = 0.5f;
		soundButtonOn2.scaleY = 0.5f;
		
		
		soundButtonOn2.x = helpButton.x;
		soundButtonOn2.y = helpButton.y + helpButton.height
				+ bgBattleDialog.height / 8;
		
		
		
		soundButtonOff2.scaleX = 0.5f;
		soundButtonOff2.scaleY = 0.5f;
		
		soundButtonOff2.x = soundButtonOn2.x;
		soundButtonOff2.y = soundButtonOn2.y;

		
		
		mainMenuButton.x = helpButton.x + helpButton.width + 30;
		mainMenuButton.y = helpButton.y;

		retryButton.x = mainMenuButton.x;
		retryButton.y = mainMenuButton.y + 20 ;

		returnPlayButton.x = mainMenuButton.x + mainMenuButton.width + 30;
		returnPlayButton.y = bgBattleDialog.y + bgBattleDialog.height / 3;

		soundButtonOn2.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {
				// TODO Auto-generated method stub
				Gdx.app.log("Sound Button", "Clicked");
				battleDialog.removeActor(soundButtonOn2);
				battleDialog.addActor(soundButtonOff2);
				Settings.toggleSound();

			}
		};

		helpButton.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {
				playSound(Resources.clickSound);
				// TODO Auto-generated method stub
				helpDialogShow = true;
				battleMenuShow = false;
				currentScene = 1;
			}

		};
		retryButton.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {
				playSound(Resources.clickSound);
				// TODO Auto-generated method stub
				restartRound();
				
			}

		};
		mainMenuButton.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {
				playSound(Resources.clickSound);
				// TODO Auto-generated method stub
				backToLastScreen();
			}

		};
		returnPlayButton.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {
				playSound(Resources.clickSound);
				// TODO Auto-generated method stub
				paused = false;
				battleMenuShow = false;
				helpDialogShow = false;
				
			}

		};

		soundButtonOff2.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {

//				Gdx.app.log("Sound Button", "Clicked");
				battleDialog.removeActor(soundButtonOff2);
				battleDialog.addActor(soundButtonOn2);
				Settings.toggleSound();

			}
		};

		battleDialog.addActor(bgBattleDialog);
		battleDialog.addActor(retryButton);
		battleDialog.addActor(returnPlayButton);
		battleDialog.addActor(helpButton);
		battleDialog.addActor(mainMenuButton);

		if (Settings.soundEnabled) {
			battleDialog.addActor(soundButtonOn2);
		} else {
			battleDialog.addActor(soundButtonOff2);
		}

		// win dialog
		winDialog = new Stage(480, 320, true);
		bgWinDialog = new Image("Bg win dialog", winDialogReg);
		bgWinDialog.x = bgBattleDialog.x;
		bgWinDialog.y = bgBattleDialog.y;

		nextRoundButton = new Button("Next Round",
				nextRoundButtonReg[0], nextRoundButtonReg[1]);

		nextRoundButton.clickListener = new ClickListener() {

			@Override
			public void clicked(Button arg0) {

				Gdx.app.log("Sound Button", "Clicked");
				nextRound();

			}
		};

		winDialog.addActor(bgWinDialog);
		winDialog.addActor(nextRoundButton);
		winDialog.addActor(mainMenuButton);
		winDialog.addActor(retryButton);

		// failed dialog
		failedDialog = new Stage(480, 320, true);
		bgFailedDialog = new Image("Bg failed dialog", failedDialogReg);
		bgFailedDialog.x = bgBattleDialog.x;
		bgFailedDialog.y = bgBattleDialog.y;

		failedDialog.addActor(bgFailedDialog);
		failedDialog.addActor(retryButton);
		failedDialog.addActor(mainMenuButton);

		// ======================================= dialog end // ========

		camera = new OrthographicCamera(480, 320);
		if (Gdx.graphics.getWidth() > 320) {
			if (Gdx.graphics.getWidth() == 800) {
				resolutionProblemSolver = 0;
			} else {
				resolutionProblemSolver = 80;
			}
		} else {
			resolutionProblemSolver = 120;
		}
		camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics
				.getHeight() / 2, 0);
		// TODO Auto-generated method stub
		centerX = Gdx.graphics.getWidth() / 2;
		centerY = (Gdx.graphics.getHeight() - 60) / 2;
		plusLaser = 0;
		plusPunch = 0;
		plusSpecial = 0;
		bool = true;
//		Gdx.app.log("Loading", "Mulai " + Gdx.graphics.getWidth() + " "
//				+ Gdx.graphics.getHeight());
		batch = Resources.batch;

		arena = new Pixmap(Gdx.files.internal("dll/arena.png"));
		arena.setBlending(Pixmap.Blending.None);

		texB = Resources.texB;
		texLaser = Resources.texLaser;
		
		//
	
		punchRegion = new TextureRegion(Resources.buttonDll,
				64 * 4, 64 * 2, 64, 64);
		shieldOnRegion =new TextureRegion(Resources.texNewModeButton,
				64 * 6, 0, 64, 64);
		shieldOffRegion = new TextureRegion(Resources.texNewModeButton,
				64 * 2, 0, 64, 64);
		
		invisOnRegion =new TextureRegion(Resources.texNewModeButton,
				0, 64, 64, 64);
		invisOffRegion = new TextureRegion(Resources.texNewModeButton,
				0 , 0, 64, 64);
		imperialRegion = new TextureRegion(Resources.texNewModeButton,
				64 * 4, 0, 64, 64);
		
		laserRegion = new TextureRegion(Resources.buttonDll,
				64 * 4, 64, 64, 64);
		//
	

		texGreenSlime = Resources.texGreenSlime;
		texBlueSlime = Resources.texBlueSlime;
		texRedSlime = Resources.texRedSlime;
		texOrangeSlime = Resources.texOrangeSlime;
		texLittleGomu = Resources.texLittleGomu;
		texGomuGomu = Resources.texGomuGomu;
		texGomuKing = Resources.texGomuKing;
		texBoguriWarrior = Resources.texBoguriWarrior;
		texBoguriChieftain = Resources.texBoguriChieftain;
		texInsaneBoguri = Resources.texInsaneBoguri;
		texBlueRepetol = Resources.texBlueRepetol;
		texRedRepetol = Resources.texRedRepetol;
		texVioletRepetol = Resources.texVioletRepetol;
		texBlack = Resources.texBlack;
		texBlack2 = Resources.texBlack2;
		texBlack3 = Resources.texBlack3;
		texBlack4 = Resources.texBlack4;
		
		texImmunity = Resources.texImmunity;

//		texBrain = texBrain;
//		texKidney =texKidney;
//		texLiver =texLiver;
//		texLung = texLung;
//		
		texTime = Resources.texTime;
		

		accelX = (int) Gdx.input.getAccelerometerX();
		accelY = (int) Gdx.input.getAccelerometerY();
		accelZ = (int) Gdx.input.getAccelerometerZ();
		azimuth = (int) Gdx.input.getAzimuth();

		spriteLung = new Sprite(texLung, 0, 0, 341, 512);
		spriteLiver = new Sprite(texLiver, 0, 0, 256, 256);
		spriteKidney1 = new Sprite(texKidney, 0, 0, 128, 256);
		spriteKidney2 = new Sprite(texKidney, 0, 0, 128, 256);
		spriteKidney2.setScale(-1, 1);
		spriteBrain = new Sprite(texBrain, 0, 0, 341, 256);

		spriteSpecialButton = new Sprite(Resources.buttonDll, 64 * 4, 64 * 4,
				64, 64);
		spriteModeButton = new Sprite(Resources.buttonDll, 64 * 4, 64 * 2, 64,
				64);
		spriteImmunIcon = new Sprite(texImmunity, 60, 0, 30, 40);
		spriteViroIcon = new Sprite(texRedRepetol, 5, 5, 52, 52);
//		spriteHealth = new Sprite(texHealth, 0, 0, 160, 32);
//		spriteBar = new Sprite(texBar, 0, 0, 128, 16);
//		spriteEnergy = new Sprite(texEnergy, 0, 0, 160, 32);
		spriteHealth = new Sprite(Resources.buttonDll,64*8,64*7+32,160,32);
		spriteBar = new Sprite( Resources.buttonDll,64*8+160, 512-16, 128, 16);
		spriteEnergy = new Sprite(Resources.buttonDll,64*8,64*7,160,32);
		spriteBar2 = new Sprite( Resources.buttonDll,64*8+160, 512-16, 128, 16);
		
		spriteTime1 = new Sprite(texTime, 0, 0, 32, 32);
		spriteTime2 = new Sprite(texTime, 0, 0, 32, 32);
		spriteTime3 = new Sprite(texTime, 0, 0, 32, 32);
		spriteTime4 = new Sprite(texTime, 0, 0, 32, 32);
		spriteMinuteSecond = new Sprite(texTime, 320, 0, 32, 32);
		spriteCountEnemies1 = new Sprite(texTime, 0, 0, 32, 32);
		spriteCountEnemies2 = new Sprite(texTime, 0, 0, 32, 32);
		spriteCountVaccine1 = new Sprite(texTime, 0, 0, 32, 32);
		spriteCountVaccine2 = new Sprite(texTime, 0, 0, 32, 32);
		
		sprite = new Sprite(Resources.playerdialog, 0, 0, 60, 40);
	
		spriteLight = new Sprite(Resources.buttonDll,
				64 * 12, 0, 64 * 4, 64 * 4 );
		sprite.setRegion(0, 0, 60, 40);
		sprite.setPosition((Gdx.graphics.getWidth() / 2) - 30, ((Gdx.graphics
				.getHeight() - 60) / 2) - 20);
		spriteLight.setPosition((Gdx.graphics.getWidth() / 2) - 32,
				((Gdx.graphics.getHeight() - 60) / 2) - 32);
		spriteLaser = new Sprite(texLaser,0,0,64,4);
		spriteLaser.setColor(1,1,0,1);
		spriteLaser.setSize(128, 4);
		

		// ===================================
		// Gdx.app.log("Saving", "Selesai medDroid.x : "
		// + Gdx.graphics.getWidth() + " medDroid.y : "
		// + Gdx.graphics.getHeight() + " Warna : "
		// + arena.getPixel(medDroid.x, medDroid.y));
		initialized = true;
//		Gdx.app.log("Init battle", "Selesai");
	}

	public BattleScreen(MainAppListener mainListener, Screen lasScreen) {
		// TODO Auto-generated constructor stub
//		Gdx.app.log("Battle ARENA", "Constructor");
		this.mainListener = mainListener;
		this.lastScreen = lasScreen;
		initialized = false;
		initResources();
	}

	// ==================================

	// ===================================

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
//		Gdx.app.log("Arena =====", "dispose!!!!!");
		arena.dispose();
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
//		Gdx.app.log("Arena", "hide");
		Resources.stopAllMusics();
		dispose();
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
//		Gdx.app.log("Arena", "pause");
//		arena.dispose();
		paused = true;
		battleMenuShow = true;
	}

	@Override
	public void render(float arg0) {
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Clear Screen
		if (paused) {
			accelX = (int) Gdx.input.getAccelerometerX();
			accelY = (int) Gdx.input.getAccelerometerY();
			accelZ = (int) Gdx.input.getAccelerometerZ();
			azimuth = (int) Gdx.input.getAzimuth();
			
			if (battleMenuShow) {
				helpButton.x = bgBattleDialog.x + bgBattleDialog.width / 4 + 20;
				helpButton.y = bgBattleDialog.y + 30;

				retryButton.x = mainMenuButton.x;
				retryButton.y = helpButton.y +helpButton.height
				+ bgBattleDialog.height / 8 - 5 ;
				
				soundButtonOn2.x = helpButton.x -15 ;
				soundButtonOn2.y = retryButton.y - soundButtonOn2.height/3 +5;

				soundButtonOff2.x = soundButtonOn2.x;
				soundButtonOff2.y = soundButtonOn2.y;

				mainMenuButton.x = helpButton.x + helpButton.width + 30;
				mainMenuButton.y = helpButton.y;

				returnPlayButton.x = mainMenuButton.x + mainMenuButton.width
						+ 15;
				returnPlayButton.y = bgBattleDialog.y + bgBattleDialog.height
						/ 3;

				batch.disableBlending();
				batch.begin();
				sprite2.draw(batch);
				batch.end();
				batch.enableBlending();
				battleDialog.draw();
				helpDialogShow = false;
			}
			if (helpDialogShow) {
				battleMenuShow = false;
				batch.disableBlending();

				switch (currentScene) {
				case 1: {
					batch.begin();
					batch.draw(Resources.help[1], x0, y0);
					batch.end();
					break;
				}
				case 2: {
					batch.begin();
					batch.draw(Resources.help[2], x0, y0);
					batch.end();
					break;
				}
				case 3: {
					batch.begin();
					batch.draw(Resources.help[3], x0, y0);
					batch.end();
					break;
				}
				case 4: {
					batch.begin();
					batch.draw(Resources.help[4], x0, y0);
					batch.end();
					break;
				}
				case 5: {
					batch.begin();
					batch.draw(Resources.help[5], x0, y0);
					batch.end();
					break;
				}

				}
				batch.enableBlending();

			}
			if (winDialogShow) {
//				if (!completedSound){
//					Resources.stopAllMusics();
//					playSound(Resources.winSound);
//					completedSound=true;
//				}
				
				batch.disableBlending();
				batch.begin();
				sprite2.draw(batch);
				
				batch.end();
				batch.enableBlending();
				
				mainMenuButton.x = 240 - mainMenuButton.width
						+ mainMenuButton.width - 20;
				mainMenuButton.y = helpButton.y + 20;

				retryButton.x = mainMenuButton.x + 50;
				retryButton.y = mainMenuButton.y;

				nextRoundButton.x = retryButton.x + 50;
				nextRoundButton.y = retryButton.y;

				winDialog.draw();

				batch.begin();

				if (score != 0)
					batch.draw(Resources.medal[score], x0 + 120, y0 + 180);

				batch.end();

			}
			if (failedDialogShow) {
				
				if (!completedSound){
					Resources.stopAllMusics();
					playSound(Resources.loseSound);
					completedSound=true;
				}
				batch.disableBlending();
				batch.begin();
				sprite2.draw(batch);
				batch.end();
				batch.enableBlending();
				
				mainMenuButton.x = 240 - mainMenuButton.width
						+ mainMenuButton.width;
				mainMenuButton.y = helpButton.y + 20;

				retryButton.x = mainMenuButton.x + 50;
				retryButton.y = mainMenuButton.y;

				failedDialog.draw();
			}
			

//			if (accelX >0)
//			Resources.drawAngka(String.valueOf(accelX), 0, 150,true);
//			else
//				Resources.drawAngka(String.valueOf(Math.abs(accelX)), 0, 150,false);
//			if (accelY >0)
//				Resources.drawAngka(String.valueOf(accelY), 0, 100,true);
//				else
//					Resources.drawAngka(String.valueOf(Math.abs(accelY)), 0, 100,false);
//			if (accelZ >0)
//				Resources.drawAngka(String.valueOf(accelZ), 0, 0,true);
//				else
//					Resources.drawAngka(String.valueOf(Math.abs(accelZ)), 0, 0,false);
				
			
			

		} else {

			// ==================isi render di bawah
			// =====================================

			roundTime.runTime();
			batch.begin();
//			batch.disableBlending();
			sprite2.draw(batch);
//			batch.enableBlending();
			batch.end();
			drawOrgan();
			drawVaccineOrb();
			drawEnemies();
			drawMedDroid();
			drawMisc();
			gameAct();
			if (!(passingWin || passingLose)) {
				for (Enemy enemy : listOfEnemies.keySet()) {
					enemy.autoMove();
					if (enemy.health <= 0) {
						listOfEnemies.put(enemy, true);
					}
				}
				for (Enemy enemy : listOfEnemies.keySet()) {
					if (listOfEnemies.get(enemy) == true) {
						listOfEnemies2.add(enemy);
					}
				}

				for (Enemy enemy : listOfEnemies2) {
					listOfEnemies.remove(enemy);
				}

				listOfEnemies2.removeAll(listOfEnemies2);	
				if (BlueRepetol.isBlueBertelur && !BlueRepetol.isIntersectMedDroid()) {
					BlueRepetol.addEnemySlime();
					BlueRepetol.isBlueBertelur = false;
				}
				if (SMC.isBertelur) {
					SMC.addEnemySlime();
					SMC.isBertelur = false;
				}
				if (RedRepetol.isRedBertelur && !RedRepetol.isIntersectMedDroid()) {
					RedRepetol.addEnemySlime();
					RedRepetol.isRedBertelur = false;
				}
				if (VioletRepetol.isVioletBertelur && !VioletRepetol.isIntersectMedDroid()) {
					VioletRepetol.addEnemySlime();
					VioletRepetol.isVioletBertelur = false;
				}
			}

			// ==================isi render di atas
			// =====================================
		}
//
//		Resources.drawAngka(String.valueOf(stageNumber), x0, y0, true);
//		Resources.drawTitikDua(x0 + 20, y0, true);
//		Resources.drawAngka(String.valueOf(roundNumber), x0 + 60, y0, true);

		camera.update();
		batch.setProjectionMatrix(camera.combined);

	}

	@Override
	public void resize(int arg0, int arg1) {
		// TODO Auto-generated method stub
//		Gdx.app.log("Battle", "Resize");
		

	}

	@Override
	public void resume() {
		accelX = (int) Gdx.input.getAccelerometerX();
		accelY = (int) Gdx.input.getAccelerometerY();
		accelZ = (int) Gdx.input.getAccelerometerZ();
		azimuth = (int) Gdx.input.getAzimuth();
		
//		arena = new Pixmap(Gdx.files.internal("dll/arena.png"));
//		arena.setBlending(Pixmap.Blending.None);
//		Gdx.app.log("Accel", "X = " + Gdx.input.getAccelerometerX() + " Y = "
//				+ Gdx.input.getAccelerometerY() + " Z = "
//				+ Gdx.input.getAccelerometerZ());
//		Gdx.app.log("Battle", "Resume");
	
		paused = true;
		battleMenuShow = true;

	}

	@Override
	public void show() {
//		Gdx.app.log("Battle", "Show");
		completedSound = false;
		
		Resources.stopAllMusics();

		if (stageNumber == 5 && roundNumber == 5) {
			Resources.playMusic(Resources.bgmBoss);
		} else
			Resources.playMusic(Resources.bgmBattle);

		
		if (lastScreen instanceof StoryScreen) {
			if (stageNumber == 1){
				currentScene = 1;
				paused = true;
				helpDialogShow = true;
			}
		}

		Gdx.input.setInputProcessor(this);
	}

	@Override
	public boolean keyDown(int arg0) {
		// TODO Auto-generated method stub

		return false;
	}

	public void backToLastScreen() {

		if (lastScreen instanceof RoundSelectScreen) {
			if (((RoundSelectScreen) lastScreen).currentStage == 1) {
				setState(MainAppListener.STAGE_1_ROUND);
			} else if (((RoundSelectScreen) lastScreen).currentStage == 2) {
				setState(MainAppListener.STAGE_2_ROUND);
			} else if (((RoundSelectScreen) lastScreen).currentStage == 3) {
				setState(MainAppListener.STAGE_3_ROUND);
			} else if (((RoundSelectScreen) lastScreen).currentStage == 4) {
				setState(MainAppListener.STAGE_4_ROUND);
			} else if (((RoundSelectScreen) lastScreen).currentStage == 5) {
				setState(MainAppListener.STAGE_5_ROUND);
			}
		} else if (lastScreen instanceof StoryScreen) {
			if (((StoryScreen) lastScreen).storyNumber == 1) {
				setState(MainAppListener.STAGE_1_ROUND);
			} else if (((StoryScreen) lastScreen).storyNumber == 2) {
				setState(MainAppListener.STAGE_2_ROUND);
			} else if (((StoryScreen) lastScreen).storyNumber == 3) {
				setState(MainAppListener.STAGE_3_ROUND);
			} else if (((StoryScreen) lastScreen).storyNumber == 4) {
				setState(MainAppListener.STAGE_4_ROUND);
			} else if (((StoryScreen) lastScreen).storyNumber == 5) {
				setState(MainAppListener.STAGE_5_ROUND);
			} else if (((StoryScreen) lastScreen).storyNumber == 6) {
				setState(MainAppListener.STAGE_5_ROUND);
			} else if (((StoryScreen) lastScreen).storyNumber == 7) {
				setState(MainAppListener.STAGE_5_ROUND);
			}
		}
		paused = false;
		battleMenuShow = false;

	}

	protected void nextRound() {
		// TODO Auto-generated method stub
		paused = false;
		winDialogShow = false;
		failedDialogShow = false;
		if (stageNumber < 5) {
			if (roundNumber < 5) {
				// initRound(stageNumber,roundNumber+1);
				mainListener.roundScreen.currentStage = stageNumber;
				Screen loading = new LoadingScreen(mainListener.roundScreen,
						roundNumber + 1);
				mainListener.setScreen(loading);

			} else {
				if (stageNumber + 1 == 2)
					mainListener.setState(MainAppListener.STORY_2);
				if (stageNumber + 1 == 3)
					mainListener.setState(MainAppListener.STORY_3);
				if (stageNumber + 1 == 4)
					mainListener.setState(MainAppListener.STORY_4);
				if (stageNumber + 1 == 5)
					mainListener.setState(MainAppListener.STORY_5);

			}
		} else {
			if (roundNumber == 4) {
				mainListener.setState(MainAppListener.STORY_6);
			} else if (roundNumber == 5) {
				mainListener.setState(MainAppListener.STORY_7);
			} else {
				// initRound(stageNumber,roundNumber+1);
				mainListener.roundScreen.currentStage = stageNumber;
				Screen loading = new LoadingScreen(mainListener.roundScreen,
						roundNumber + 1);
				mainListener.setScreen(loading);
				//				
			}
		}

	}

	@Override
	public boolean keyTyped(char arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean keyUp(int arg0) {
		// TODO Auto-generated method stub
		if (arg0 == Input.Keys.BACK) {
			// backToLastScreen();
			playSound(Resources.backSound);
			if (paused) {
				if (!helpDialogShow ) {
					if (winDialogShow&&!failedDialogShow){
						
					}else if (failedDialogShow&&!winDialogShow){
						
					}else{
						paused = false;
						if (battleMenuShow) {
							battleMenuShow = false;
						}
						helpDialogShow = false;
					}
				}if (winDialogShow){
					
				}
			} else {
				
					paused = true;
					battleMenuShow = true;
					helpDialogShow = false;
				
				

			}

		} else if (arg0 == Input.Keys.MENU) {
			playSound(Resources.clickSound);
			if (paused) {
				if (battleMenuShow) {
					paused = false;
					battleMenuShow = false;
				}
			} else {
				paused = true;
				battleMenuShow = true;
				helpDialogShow = false;
			}
		}
//		else if (arg0 == Input.Keys.DPAD_LEFT) {
//			playSound(Resources.clickSound);
//			// if (paused) {
//			// if (battleMenuShow) {
//			// paused = false;
//			// battleMenuShow = false;
//			// }
//			// } else {
//			// paused = true;
//			// battleMenuShow = true;
//			// helpDialogShow = false;
//			// }
//			paused = true;
//			winDialogShow = false;
//			failedDialogShow = true;
//		} else if (arg0 == Input.Keys.DPAD_RIGHT) {
//			playSound(Resources.clickSound);
//			// if (paused) {
//			// if (battleMenuShow) {
//			// paused = false;
//			// battleMenuShow = false;
//			// }
//			// } else {
//			// paused = true;
//			// battleMenuShow = true;
//			// helpDialogShow = false;
//			// }
//			paused = true;
//			winDialogShow = true;
//			failedDialogShow = false;
//
//		}
		return false;
	}

	@Override
	public boolean scrolled(int arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchDown(int arg0, int arg1, int arg2, int arg3) {
		// TODO Auto-generated method stub
		// return stage.touchDown(arg0, arg1, arg2, arg3);
		if (paused) {
			if (battleMenuShow) {
				return battleDialog.touchDown(arg0, arg1, arg2, arg3);
			} else if (winDialogShow) {
				return winDialog.touchDown(arg0, arg1, arg2, arg3);
			} else if (failedDialogShow) {
				return failedDialog.touchDown(arg0, arg1, arg2, arg3);
			}

		} else {
			// return stage.touchDown(arg0, arg1, arg2, arg3);
			return false;
		}
		return false;

	}

	@Override
	public boolean touchDragged(int arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub
		// return stage.touchDragged(arg0, arg1, arg2);
		return false;
	}

	@Override
	public boolean touchMoved(int arg0, int arg1) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchUp(int arg0, int arg1, int arg2, int arg3) {
		// TODO Auto-generated method stub
		// return stage.touchUp(arg0, arg1, arg2, arg3);
		if (paused) {
			if (battleMenuShow) {
				return battleDialog.touchUp(arg0, arg1, arg2, arg3);
			} else if (helpDialogShow) {
				playSound(Resources.clickSound);
				if (currentScene < numberScenes) {
					currentScene++;
					return false;
				} else {
					helpDialogShow = false;
					paused = false;
					return false;
				}
			} else if (winDialogShow) {
				return winDialog.touchUp(arg0, arg1, arg2, arg3);
			} else if (failedDialogShow) {
				return failedDialog.touchUp(arg0, arg1, arg2, arg3);
			}

			else {
				return false;
			}
		} else {
			// return stage.touchUp(arg0, arg1, arg2, arg3);
			return false;
		}
		// return false;

	}

	private void setState(int state) {

		mainListener.setState(state);
	}

	@Override
	protected void finalize() throws Throwable {
		// TODO Auto-generated method stub
		super.finalize();
//		Gdx.app.log("Arena", "Destruction");
	}

	// = ================================================================
	// ======================
	//	

	public void interfaceInitialize() {
		spriteImmunIcon.setSize(30, 30);
		spriteImmunIcon.setPosition((Gdx.graphics.getWidth() / 2) - 30,
				(Gdx.graphics.getHeight() / 2) + 125);
		spriteCountVaccine1.setSize(30, 30);
		spriteCountVaccine1.setPosition((Gdx.graphics.getWidth() / 2) - 90,
				(Gdx.graphics.getHeight() / 2) + 125);
		spriteCountVaccine1.setColor((float) 0.5, (float) 0.5, 0, 1);
		spriteCountVaccine2.setSize(30, 30);
		spriteCountVaccine2.setPosition((Gdx.graphics.getWidth() / 2) - 60,
				(Gdx.graphics.getHeight() / 2) + 125);
		spriteCountVaccine2.setColor((float) 0.5, (float) 0.5, 0, 1);
		spriteViroIcon.setSize(30, 30);
		spriteViroIcon.setPosition(Gdx.graphics.getWidth() / 2 + 70,
				(Gdx.graphics.getHeight() / 2) + 125);
		spriteCountEnemies1.setSize(30, 30);
		spriteCountEnemies1.setPosition((Gdx.graphics.getWidth() / 2) + 10,
				(Gdx.graphics.getHeight() / 2) + 125);
		spriteCountEnemies1.setColor((float) 0.5, (float) 0.5, 0, 1);
		spriteCountEnemies2.setSize(30, 30);
		spriteCountEnemies2.setPosition((Gdx.graphics.getWidth() / 2) + 40,
				(Gdx.graphics.getHeight() / 2) + 125);
		spriteCountEnemies2.setColor((float) 0.5, (float) 0.5, 0, 1);
		spriteSpecialButton.setPosition(
				(Gdx.graphics.getWidth() / 2) + 240 - 60, (Gdx.graphics
						.getHeight() / 2) - 160);
		spriteSpecialButton.setSize(60, 60);
		spriteModeButton.setPosition((Gdx.graphics.getWidth() / 2) - 240,
				(Gdx.graphics.getHeight() / 2) - 160);
		spriteModeButton.setSize(60, 60);
		spriteHealth.setPosition((Gdx.graphics.getWidth() / 2) - 240,
				(Gdx.graphics.getHeight() / 2) + 135);
		spriteHealth.setSize(150, 20);
		spriteBar.setColor(1, 0, 0, (float) 0.8);
		spriteBar.setSize(116, 7);
		spriteBar.setPosition((Gdx.graphics.getWidth() / 2) - 240 + 28,
				(Gdx.graphics.getHeight() / 2) + (float) 140.25);
		spriteEnergy.setPosition((Gdx.graphics.getWidth() / 2) - 240,
				(Gdx.graphics.getHeight() / 2) + 116);
		spriteEnergy.setSize(150, 20);
		spriteBar2.setPosition((Gdx.graphics.getWidth() / 2) - 240 + 28,
				(Gdx.graphics.getHeight() / 2) + (float) 121.25);
		spriteBar2.setColor(1, (float) 0.8, 0, (float) 0.8);
		spriteBar2.setSize(116, 7);
		spriteTime1.setPosition((Gdx.graphics.getWidth() / 2) + 240 - 32,
				(Gdx.graphics.getHeight() / 2) + 160 - 37);
		spriteTime1.setSize(32, 32);
		spriteTime2.setPosition((Gdx.graphics.getWidth() / 2) + 240 - 64,
				(Gdx.graphics.getHeight() / 2) + 160 - 37);
		spriteTime2.setSize(32, 32);
		spriteMinuteSecond.setPosition(
				(Gdx.graphics.getWidth() / 2) + 240 - 86, (Gdx.graphics
						.getHeight() / 2) + 160 - 37);
		spriteMinuteSecond.setSize(32, 32);
		spriteTime3.setPosition((Gdx.graphics.getWidth() / 2) + 240 - 108,
				(Gdx.graphics.getHeight() / 2) + 160 - 37);
		spriteTime3.setSize(32, 32);
		spriteTime4.setPosition((Gdx.graphics.getWidth() / 2) + 240 - 130,
				(Gdx.graphics.getHeight() / 2) + 160 - 37);
		spriteTime4.setSize(32, 32);
	}

	public void initRound(int stage, int round) {

		this.stageNumber = stage;
		this.roundNumber = round;
		spriteMinuteSecond.setRegion(320,0,32,32);
		passingLose = false;
		passingWin = false;

		tesRound++;
		score = 0;
		medDroid = new MedDroid(100, 50, 1024 - (Gdx.graphics.getWidth() / 2),
				230);
		sprite2 = new Sprite(texB, medDroid.x
				+ (Gdx.graphics.getWidth() / 2) - 240, medDroid.y
				+ (Gdx.graphics.getHeight() / 2) - 160
				+ resolutionProblemSolver, 480, 320);
		sprite2.setPosition((Gdx.graphics.getWidth() / 2) - 240, (Gdx.graphics
				.getHeight() / 2) - 160);
		listOfEnemies = new HashMap<Enemy, Boolean>();
		listOfVaccines = new ArrayList<Vaccine>();
		listOfOrb = new ArrayList<Orb>();
		listOfEnemies2 = new ArrayList<Enemy>();

		lung = new Organ(centerX - 190, centerY - 560, spriteLung, Organ.LUNG);
		kidney1 = new Organ(centerX - 205, centerY - 700, spriteKidney1,
				Organ.KIDNEY);
		kidney2 = new Organ(centerX + 85, centerY - 700, spriteKidney2,
				Organ.KIDNEY);
		liver = new Organ(centerX -170, centerY - 620, spriteLiver, Organ.LIVER);
		brain = new Organ(centerX - 190, centerY + 15, spriteBrain, Organ.BRAIN);

		if (stage == 1) {
			if (round == 1) {
				listOfEnemies
						.put(new GreenSlime(centerX - 100, centerY), false);
				listOfEnemies
						.put(new GreenSlime(centerX + 100, centerY), false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY + 100), false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 200), false);
				listOfVaccines.add(new Vaccine(centerX, centerY + 150));
				secondLimit = 50;
				minuteLimit = 0;
			} else if (round == 2) {
				listOfEnemies
						.put(new GreenSlime(centerX, centerY + 100), false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies.put(new RedSlime(centerX - 200, centerY - 250),
						false);
				listOfEnemies.put(new RedSlime(centerX - 100, centerY - 250),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 25, centerY - 250),
						false);
				listOfEnemies.put(new RedSlime(centerX + 100, centerY - 250),
						false);
				listOfEnemies.put(new RedSlime(centerX + 200, centerY - 250),
						false);
				listOfVaccines.add(new Vaccine(centerX - 50, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX + 50, centerY - 300));
				secondLimit = 5;
				minuteLimit = 1;
			} else if (round == 3) {
				listOfEnemies.put(new GreenSlime(centerX - 25, centerY - 100),
						false);
				listOfEnemies.put(new GreenSlime(centerX + 25, centerY - 100),
						false);
				listOfEnemies.put(new RedSlime(centerX - 200, centerY - 250),
						false);
				listOfEnemies.put(new RedSlime(centerX + 200, centerY - 250),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 350, centerY - 350),
						false);
				listOfEnemies.put(new BlueSlime(centerX - 350, centerY - 350),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 450, centerY - 450), false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 450, centerY - 450), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 500, centerY - 500), false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 500, centerY - 500), false);
				listOfVaccines.add(new Vaccine(centerX + 500, centerY - 550));
				listOfVaccines.add(new Vaccine(centerX - 500, centerY - 550));
				secondLimit = 40;
				minuteLimit = 1;
			} else if (round == 4) {
				listOfEnemies.put(new GomuGomu(centerX, centerY - 120), false);
				listOfEnemies.put(new GomuGomu(centerX + 50, centerY - 120),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 50, centerY - 120),
						false);
				listOfEnemies.put(new GomuGomu(centerX, centerY - 170), false);
				listOfEnemies.put(new GomuGomu(centerX + 50, centerY - 170),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 50, centerY - 170),
						false);
				secondLimit = 0;
				minuteLimit = 1;
			}	else if (round == 5){
					listOfEnemies.put(new GreenSlime(centerX+50, centerY+100),false);
					listOfEnemies.put(new GreenSlime(centerX+100, centerY+100),false);
					listOfEnemies.put(new GreenSlime(centerX-80, centerY+100),false);
					listOfEnemies.put(new GreenSlime(centerX-100, centerY+100),false);
					listOfEnemies.put(new GreenSlime(centerX, centerY-100),false);
					listOfEnemies.put(new GreenSlime(centerX+50, centerY-100),false);
					listOfEnemies.put(new GreenSlime(centerX-100, centerY-100),false);
					listOfEnemies.put(new GreenSlime(centerX-80, centerY-100),false);
					listOfEnemies.put(new GreenSlime(centerX + 40, centerY),false);
					listOfEnemies.put(new GreenSlime(centerX+ 70, centerY),false);
					listOfEnemies.put(new GreenSlime(centerX+ 100, centerY),false);
					listOfEnemies.put(new GreenSlime(centerX - 80, centerY),false);	
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY),false);
					listOfEnemies.put(new GreenSlime(centerX - 150, centerY),false);
					listOfEnemies.put(new GreenSlime(centerX, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX + 50, centerY+75),false);
					listOfEnemies.put(new GreenSlime(centerX+ 100, centerY+75),false);
					listOfEnemies.put(new GreenSlime(centerX - 80, centerY+75),false);
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY+75),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY+75),false);
					listOfEnemies.put(new GreenSlime(centerX - 150, centerY+75),false);
					listOfEnemies.put(new GreenSlime(centerX + 50, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX+ 100, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX - 80, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX - 150, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX, centerY+80),false);
					listOfEnemies.put(new GreenSlime(centerX + 75, centerY+80),false);
					listOfEnemies.put(new GreenSlime(centerX+ 100, centerY+80),false);
					listOfEnemies.put(new GreenSlime(centerX - 75, centerY+80),false);	
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY+80),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY+80),false);
					listOfEnemies.put(new GreenSlime(centerX - 150, centerY+80),false);				
					listOfEnemies.put(new GreenSlime(centerX + 75, centerY-40),false);
					listOfEnemies.put(new GreenSlime(centerX+ 100, centerY-40),false);
					listOfEnemies.put(new GreenSlime(centerX - 80, centerY-40),false);
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY-40),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY-40),false);	
					listOfEnemies.put(new GreenSlime(centerX + 75, centerY-50),false);
					listOfEnemies.put(new GreenSlime(centerX - 80, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY+50),false);
					listOfEnemies.put(new GreenSlime(centerX, centerY-80),false);
					listOfEnemies.put(new GreenSlime(centerX - 80, centerY-80),false);	
					listOfEnemies.put(new GreenSlime(centerX - 100, centerY-80),false);
					listOfEnemies.put(new GreenSlime(centerX - 125, centerY-80),false);
					listOfEnemies.put(new GreenSlime(centerX - 150, centerY-80),false);
					listOfEnemies.put(new GomuGomu(centerX-200, centerY),false);
					listOfEnemies.put(new GomuGomu(centerX+120, centerY),false);	
					listOfEnemies.put(new GomuGomu(centerX-80, centerY+100),false);
					listOfEnemies.put(new GomuGomu(centerX, centerY+125),false);
					listOfEnemies.put(new GomuGomu(centerX-100, centerY-80),false);
					listOfEnemies.put(new GomuGomu(centerX+80, centerY+100),false);	
					listOfEnemies.put(new GomuGomu(centerX-100, centerY+60),false);
					listOfEnemies.put(new GomuGomu(centerX, centerY-150),false);
					listOfVaccines.add(new Vaccine(centerX+100, centerY));
					listOfVaccines.add(new Vaccine(centerX-100, centerY));
					listOfVaccines.add(new Vaccine(centerX, centerY+100));
					listOfVaccines.add(new Vaccine(centerX, centerY-100));
					medDroid.setEnergy(90);
					secondLimit = 0;
					minuteLimit = 1;
				}
		} else if (stage == 2) {
			if (round == 1) {
				listOfEnemies.put(new RedSlime(centerX + 500, centerY - 600),
						false);
				listOfEnemies.put(new GreenSlime(centerX - 500, centerY - 600),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 200, centerY - 1200),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 300, centerY - 1200), false);
				listOfEnemies.put(new GomuGomu(centerX + 200, centerY - 250),
						false);
				listOfEnemies.put(new GomuGomu(centerX, centerY - 500), false);
				listOfEnemies.put(new GomuGomu(centerX, centerY - 600), false);
				listOfEnemies.put(new GomuGomu(centerX - 200, centerY - 250),
						false);
				listOfVaccines.add(new Vaccine(centerX - 550, centerY - 650));
				listOfVaccines.add(new Vaccine(centerX + 200, centerY - 1250));
				listOfVaccines.add(new Vaccine(centerX + 550, centerY - 650));
				secondLimit = 0;
				minuteLimit = 2;
			} else if (round == 2) {
				listOfEnemies.put(new RedSlime(centerX + 500, centerY - 600),
						false);
				listOfEnemies.put(new RedSlime(centerX + 450, centerY - 450),
						false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY + 100), false);
				listOfEnemies.put(new BlueSlime(centerX, centerY - 250), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 200, centerY - 1200), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 450, centerY - 450), false);
				listOfEnemies.put(new GomuGomu(centerX + 450, centerY - 450),
						false);
				listOfEnemies.put(new GomuKing(centerX - 50, centerY - 500),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 350, centerY - 1200),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 100, centerY - 1200),
						false);
				listOfEnemies.put(new GomuKing(centerX + 50, centerY - 800),
						false);
				listOfVaccines.add(new Vaccine(centerX - 100, centerY));
				listOfVaccines.add(new Vaccine(centerX, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX, centerY - 100));
				listOfVaccines.add(new Vaccine(centerX - 530, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX + 530, centerY - 600));
				secondLimit = 40;
				minuteLimit = 2;
			} else if (round == 3) {
				listOfEnemies.put(new GomuKing(centerX + 300, centerY - 450),
						false);
				listOfEnemies.put(new GomuKing(centerX + 500, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 500, centerY - 600),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX + 100, centerY - 1200), false);
				listOfEnemies.put(new GomuKing(centerX + 50, centerY + 100),
						false);
				listOfEnemies.put(new GomuKing(centerX - 450, centerY - 450),
						false);
				listOfEnemies.put(new GomuKing(centerX - 50, centerY - 500),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX - 350, centerY - 1200), false);
				listOfEnemies.put(new GomuGomu(centerX - 50, centerY - 100),
						false);
				listOfEnemies.put(new GomuKing(centerX + 50, centerY - 800),
						false);
				listOfEnemies.put(new GomuKing(centerX - 100, centerY - 800),
						false);
				listOfEnemies.put(new GomuKing(centerX + 100, centerY - 1000),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 50, centerY - 250),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 250, centerY - 1200),
						false);
				listOfEnemies.put(new GomuKing(centerX - 200, centerY - 1000),
						false);
				listOfVaccines.add(new Vaccine(centerX - 550, centerY - 650));
				listOfVaccines.add(new Vaccine(centerX + 550, centerY - 650));
				secondLimit = 10;
				minuteLimit = 3;
			} else if (round == 4) {
				listOfEnemies.put(new RedSlime(centerX - 50, centerY + 100),
						false);
				listOfEnemies.put(new RedSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies.put(new BlueSlime(centerX, centerY - 250), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 200, centerY - 1200), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 450, centerY - 450), false);
				listOfEnemies.put(new BlueSlime(centerX + 100, centerY - 1200),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 500, centerY - 600),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 500, centerY - 600),
						false);
				listOfEnemies.put(new GomuKing(centerX + 100, centerY - 900),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 50, centerY - 700),
						false);
				listOfVaccines.add(new Vaccine(centerX + 75, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 75, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 150, centerY));
				listOfVaccines.add(new Vaccine(centerX + 150, centerY));
				secondLimit = 40;
				minuteLimit = 2;
			} else if (round == 5) {
				listOfEnemies.put(new RedSlime(centerX - 50, centerY + 100),
						false);
				listOfEnemies.put(new RedSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies.put(new BlueSlime(centerX - 100, centerY - 250),
						false);
				listOfEnemies.put(new OrangeSlime(centerX, centerY + 100),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 450, centerY - 450), false);
				listOfEnemies.put(new BlueSlime(centerX - 100, centerY), false);
				listOfEnemies.put(new LittleGomu(centerX + 500, centerY - 600),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 500, centerY - 600),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX + 200, centerY - 1200), false);
				listOfEnemies.put(
						new LittleGomu(centerX - 200, centerY - 1200), false);
				listOfEnemies.put(new LittleGomu(centerX + 100, centerY - 250),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 50, centerY - 600),
						false);
				listOfEnemies.put(new GomuKing(centerX - 50, centerY - 400),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 50, centerY - 600),
						false);
				listOfEnemies.put(
						new BoguriWarrior(centerX - 50, centerY - 700), false);
				listOfVaccines.add(new Vaccine(centerX - 280, centerY - 1200));
				secondLimit = 15;
				minuteLimit = 3;
			}
		} else if (stage == 3) {
			if (round == 1) {
				listOfEnemies.put(new RedSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies.put(new BlueSlime(centerX, centerY - 250), false);
				listOfEnemies.put(new GomuKing(centerX - 50, centerY - 400),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 50, centerY - 600),
						false);
				listOfEnemies.put(new GomuKing(centerX + 100, centerY - 1200),
						false);
				listOfEnemies.put(new BoguriWarrior(centerX - 250,
						centerY - 1200), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 150,
						centerY - 1200), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 200,
						centerY - 1250), false);
				listOfVaccines.add(new Vaccine(centerX + 150, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX - 250, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX + 180, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX - 280, centerY - 1200));
				secondLimit = 0;
				minuteLimit = 2;
			} else if (round == 2) {
				listOfEnemies.put(new RedSlime(centerX - 100, centerY), false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies.put(new BlueSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies.put(new OrangeSlime(centerX + 100, centerY),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 450, centerY - 450), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 500,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 500,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 550,
						centerY - 650), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 450,
						centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX + 450,
						centerY - 650), false);
				listOfVaccines.add(new Vaccine(centerX + 500, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX - 500, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY - 400));
				listOfVaccines.add(new Vaccine(centerX, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY + 150));
				secondLimit = 30;
				minuteLimit = 2;
			} else if (round == 3) {
				listOfEnemies.put(new RedSlime(centerX - 100, centerY + 100),
						false);
				listOfEnemies
						.put(new GreenSlime(centerX, centerY - 100), false);
				listOfEnemies.put(new BlueSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 250), false);
				listOfEnemies.put(new LittleGomu(centerX + 100, centerY - 250),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 100, centerY - 250),
						false);
				listOfEnemies.put(new GomuKing(centerX + 550, centerY - 600),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 500, centerY - 650),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 450, centerY - 600),
						false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 700), false);
				listOfEnemies.put(new LittleGomu(centerX - 100, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 100, centerY - 600),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX - 200, centerY - 1200), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 500,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 100,
						centerY - 1200), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 550, centerY - 650), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 450,
						centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX + 200,
						centerY - 1250), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 300,
						centerY - 1200), false);
				listOfVaccines.add(new Vaccine(centerX + 240, centerY - 1100));
				listOfVaccines.add(new Vaccine(centerX + 260, centerY - 1200));
				secondLimit = 15;
				minuteLimit = 3;
			} else if (round == 4) {
				listOfEnemies.put(new RedSlime(centerX, centerY - 200), false);
				listOfEnemies.put(
						new GreenSlime(centerX - 150, centerY - 1000), false);
				listOfEnemies.put(new BlueSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 100, centerY - 1000), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 450, centerY - 450), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 100, centerY),
						false);
				listOfEnemies.put(new BoguriWarrior(centerX + 450,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 550,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 100,
						centerY - 1200), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 300,
						centerY - 1200), false);
				listOfEnemies.put(new BoguriChieftain(centerX + 100, centerY),
						false);
				listOfEnemies.put(new BoguriChieftain(centerX + 550,
						centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 450,
						centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX + 200,
						centerY - 1200), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 200,
						centerY - 1200), false);
				listOfEnemies.put(new InsaneBoguri(centerX, centerY + 100),
						false);
				listOfEnemies.put(
						new InsaneBoguri(centerX + 500, centerY - 650), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 500, centerY - 650), false);
				listOfEnemies.put(new InsaneBoguri(centerX + 150,
						centerY - 1250), false);
				listOfEnemies.put(new InsaneBoguri(centerX - 250,
						centerY - 1250), false);
				listOfVaccines.add(new Vaccine(centerX, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX, centerY - 400));
				secondLimit = 45;
				minuteLimit = 2;
			} else if (round == 5) {
				listOfEnemies.put(new RedSlime(centerX, centerY + 100), false);
				listOfEnemies.put(new GreenSlime(centerX - 100, centerY - 100),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 50, centerY - 100),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 100, centerY + 100), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 100, centerY + 100), false);
				listOfEnemies.put(new GomuKing(centerX + 450, centerY - 600),
						false);
				listOfEnemies.put(new GomuKing(centerX - 450, centerY - 600),
						false);
				listOfEnemies.put(new GomuKing(centerX + 50, centerY - 1200),
						false);
				listOfEnemies.put(new GomuKing(centerX - 250, centerY - 1200),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 550, centerY - 600),
						false);
				listOfEnemies.put(new LittleGomu(centerX - 550, centerY - 600),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX + 150, centerY - 1200), false);
				listOfEnemies.put(
						new LittleGomu(centerX - 350, centerY - 1200), false);
				listOfEnemies.put(new GomuGomu(centerX + 500, centerY - 650),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 500, centerY - 650),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 100, centerY - 1250),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 300, centerY - 1250),
						false);
				listOfEnemies.put(new InsaneBoguri(centerX, centerY - 200),
						false);
				listOfEnemies.put(new InsaneBoguri(centerX + 100,
						centerY - 1000), false);
				listOfEnemies.put(new InsaneBoguri(centerX - 150,
						centerY - 1000), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX + 450, centerY - 450), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 450, centerY - 450), false);
				listOfEnemies.put(
						new BlueRepetol(centerX - 100, centerY - 400), false);
				listOfVaccines.add(new Vaccine(centerX + 550, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX - 550, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY - 750));
				listOfVaccines.add(new Vaccine(centerX + 150, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX - 250, centerY - 1200));
				secondLimit = 15;
				minuteLimit = 3;
			}
		} else if (stage == 4) {
			if (round == 1) {
				listOfEnemies.put(new LittleGomu(centerX - 50, centerY - 120),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 50, centerY - 120),
						false);
				listOfEnemies.put(new RedRepetol(centerX + 200, centerY - 600),
						false);
				listOfEnemies.put(
						new BlueRepetol(centerX - 300, centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 100,
						centerY - 250), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 100,
						centerY - 250), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 100,
						centerY - 350), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 100,
						centerY - 450), false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 500),
						false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 700), false);
				listOfEnemies.put(new RedSlime(centerX + 500, centerY - 500),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 450, centerY - 450),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 500, centerY - 620), false);
				listOfEnemies.put(new RedSlime(centerX - 500, centerY - 500),
						false);
				listOfEnemies.put(new BlueSlime(centerX - 450, centerY - 450),
						false);
				listOfEnemies.put(new GreenSlime(centerX - 500, centerY - 620),
						false);
				listOfEnemies.put(new InsaneBoguri(centerX - 200,
						centerY - 1000), false);
				listOfEnemies.put(new InsaneBoguri(centerX + 100,
						centerY - 1000), false);
				listOfVaccines.add(new Vaccine(centerX - 530, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX + 530, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 200, centerY - 1150));
				listOfVaccines.add(new Vaccine(centerX + 70, centerY - 1150));
				listOfVaccines.add(new Vaccine(centerX, centerY - 800));
				secondLimit = 15;
				minuteLimit = 3;
			} else if (round == 2) {
				listOfEnemies.put(new BoguriChieftain(centerX - 50,
						centerY - 150), false);
				listOfEnemies.put(new BoguriChieftain(centerX + 50,
						centerY - 150), false);
				listOfEnemies.put(
						new BoguriWarrior(centerX - 50, centerY - 175), false);
				listOfEnemies.put(
						new BoguriWarrior(centerX + 50, centerY - 175), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 50, centerY - 200), false);
				
				listOfEnemies.put(new BoguriWarrior(centerX, centerY - 150),
						false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 175),
						false);
				listOfEnemies.put(new InsaneBoguri(centerX, centerY - 200),
						false);
				listOfEnemies.put(new RedRepetol(centerX, centerY - 1080),
						false);
				listOfEnemies.put(new BlueRepetol(centerX, centerY - 930),
						false);
				listOfEnemies.put(new VioletRepetol(centerX, centerY - 800),
						false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 400), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 500), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 600), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 700), false);
				listOfEnemies.put(new GomuGomu(centerX - 100, centerY - 400),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 120, centerY - 500),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 120, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX - 100, centerY - 700),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 100, centerY - 400),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 120, centerY - 500),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 120, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 100, centerY - 700),
						false);
				listOfEnemies.put(new RedSlime(centerX + 120, centerY - 1200),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 90, centerY - 1150),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 180, centerY - 1200), false);
				listOfEnemies.put(
						new GreenSlime(centerX + 120, centerY - 1000), false);
				listOfEnemies.put(new RedSlime(centerX - 210, centerY - 1000),
						false);
				listOfEnemies.put(new BlueSlime(centerX - 190, centerY - 1150),
						false);
				listOfEnemies.put(
						new GreenSlime(centerX - 200, centerY - 1150), false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 240, centerY - 1200), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 200, centerY - 900), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX + 100, centerY - 900), false);
				listOfEnemies.put(new GomuKing(centerX - 200, centerY - 800),
						false);
				listOfEnemies.put(new GomuKing(centerX + 100, centerY - 800),
						false);
				listOfVaccines.add(new Vaccine(centerX, centerY + 120));
				listOfVaccines.add(new Vaccine(centerX + 75, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 75, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 150, centerY));
				listOfVaccines.add(new Vaccine(centerX + 150, centerY));
				listOfVaccines.add(new Vaccine(centerX + 150, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX - 250, centerY - 1200));

				secondLimit = 0;
				minuteLimit = 4;

			} else if (round == 3){
				listOfEnemies.put(new BoguriChieftain(centerX-50, centerY - 150),false);
				listOfEnemies.put(new BoguriWarrior(centerX+50, centerY - 175),false);
				listOfEnemies.put(new InsaneBoguri(centerX-50, centerY - 200),false);
				listOfEnemies.put(new InsaneBoguri(centerX+50, centerY - 200),false);
				listOfEnemies.put(new BoguriWarrior(centerX, centerY - 150),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 175),false);
				listOfEnemies.put(new InsaneBoguri(centerX, centerY - 200),false);
				listOfEnemies.put(new RedRepetol(centerX+150, centerY- 1200),false);
				listOfEnemies.put(new BlueRepetol(centerX-150, centerY- 1200),false);
				listOfEnemies.put(new GomuKing(centerX - 380, centerY - 410),false);
				listOfEnemies.put(new GomuKing(centerX - 390, centerY - 410),false);
				listOfEnemies.put(new GomuKing(centerX + 300, centerY - 410),false);
				listOfEnemies.put(new GomuKing(centerX + 320, centerY - 410),false);
				listOfEnemies.put(new LittleGomu(centerX-100, centerY - 660),false);
				listOfEnemies.put(new LittleGomu(centerX-150, centerY - 700),false);
				listOfEnemies.put(new GomuGomu(centerX-100, centerY - 630),false);
				listOfEnemies.put(new GomuGomu(centerX-140, centerY - 730),false);
				listOfEnemies.put(new LittleGomu(centerX+170, centerY - 660),false);
				listOfEnemies.put(new LittleGomu(centerX+120, centerY - 700),false);
				listOfEnemies.put(new GomuGomu(centerX+140, centerY - 630),false);
				listOfEnemies.put(new GomuGomu(centerX+160, centerY - 730),false);
				listOfEnemies.put(new RedSlime(centerX+120, centerY-400),false);
				listOfEnemies.put(new BlueSlime(centerX+90, centerY-500),false);
				listOfEnemies.put(new OrangeSlime(centerX+180, centerY-600),false);
				listOfEnemies.put(new GreenSlime(centerX+120, centerY-700),false);
				listOfEnemies.put(new RedSlime(centerX-210, centerY-400),false);
				listOfEnemies.put(new BlueSlime(centerX-190, centerY-500),false);
				listOfEnemies.put(new GreenSlime(centerX-200, centerY-600),false);
				listOfEnemies.put(new OrangeSlime(centerX+200, centerY-700),false);
				listOfEnemies.put(new GomuKing(centerX-200, centerY - 200),false);
				listOfEnemies.put(new GomuKing(centerX+100, centerY - 200),false);
				listOfVaccines.add(new Vaccine(centerX+500, centerY-600));
				listOfVaccines.add(new Vaccine(centerX-500, centerY-600));
				listOfVaccines.add(new Vaccine(centerX+550, centerY-600));
				listOfVaccines.add(new Vaccine(centerX-550, centerY-600));
				listOfVaccines.add(new Vaccine(centerX, centerY-750));
				listOfVaccines.add(new Vaccine(centerX+150, centerY-1200));
				listOfVaccines.add(new Vaccine(centerX-250, centerY-1200));
				listOfVaccines.add(new Vaccine(centerX+180, centerY-1200));
				listOfVaccines.add(new Vaccine(centerX-280, centerY-1200));
								
				secondLimit = 15;
				minuteLimit = 4;
			}
			else if (round == 4){
				listOfEnemies.put(new RedRepetol(centerX+145, centerY- 1150),false);
				listOfEnemies.put(new RedRepetol(centerX+155, centerY- 1180),false);
				listOfEnemies.put(new BlueRepetol(centerX-200, centerY- 1200),false);
				listOfEnemies.put(new BlueRepetol(centerX-170, centerY- 1150),false);
				listOfEnemies.put(new VioletRepetol(centerX-100, centerY- 600),false);
				listOfEnemies.put(new VioletRepetol(centerX+100, centerY- 600),false);
				listOfEnemies.put(new BoguriChieftain(centerX+150, centerY),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 270),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 330),false);
				listOfEnemies.put(new BoguriWarrior(centerX-280, centerY - 290),false);
				listOfEnemies.put(new BoguriWarrior(centerX+250, centerY - 270),false);
				listOfEnemies.put(new InsaneBoguri(centerX-340, centerY - 270),false);
				listOfEnemies.put(new InsaneBoguri(centerX+180, centerY - 570),false);
				listOfEnemies.put(new BoguriWarrior(centerX-260, centerY - 1100),false);
				listOfEnemies.put(new BoguriWarrior(centerX+170, centerY - 1100),false);
				listOfEnemies.put(new InsaneBoguri(centerX-270, centerY - 1108),false);
				listOfEnemies.put(new InsaneBoguri(centerX+108, centerY - 1108),false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 400), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 500), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 600), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 700), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 750), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 650), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 550), false);
				listOfEnemies.put(new GomuKing(centerX, centerY - 450), false);
				listOfVaccines.add(new Vaccine(centerX+500, centerY-600));
				listOfVaccines.add(new Vaccine(centerX-500, centerY-600));
				listOfVaccines.add(new Vaccine(centerX , centerY-400));
				listOfVaccines.add(new Vaccine(centerX, centerY-600));
				listOfVaccines.add(new Vaccine(centerX, centerY+150));
				listOfVaccines.add(new Vaccine(centerX+150, centerY));
				listOfVaccines.add(new Vaccine(centerX-200, centerY));
				listOfVaccines.add(new Vaccine(centerX+150, centerY-1200));
				listOfVaccines.add(new Vaccine(centerX-250, centerY-1200));
				listOfVaccines.add(new Vaccine(centerX+180, centerY-1200));
				listOfVaccines.add(new Vaccine(centerX-280, centerY-1200));
				secondLimit = 30;
				minuteLimit = 4;
			}
			else if (round == 5){
				listOfEnemies.put(new GomuGomu(centerX+150, centerY),false);
				listOfEnemies.put(new LittleGomu(centerX+300, centerY- 500),false);
				listOfEnemies.put(new GomuGomu(centerX-50, centerY- 700),false);
				listOfEnemies.put(new BlueRepetol(centerX+270, centerY- 420),false);
				listOfEnemies.put(new GomuKing(centerX+300, centerY- 470),false);
				listOfEnemies.put(new GomuGomu(centerX-300, centerY- 420),false);
				listOfEnemies.put(new GomuKing(centerX-340, centerY- 470),false);
				listOfEnemies.put(new VioletRepetol(centerX-270, centerY-1200),false);
				listOfEnemies.put(new LittleGomu(centerX-460, centerY- 1200),false);
				listOfEnemies.put(new GomuGomu(centerX-20, centerY+ 260),false);
				listOfEnemies.put(new LittleGomu(centerX-670, centerY-600),false);
				listOfEnemies.put(new GomuKing(centerX+450, centerY- 730),false);
				listOfEnemies.put(new RedRepetol(centerX+150, centerY-1200),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY-100),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 100),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 150),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 200),false);
				listOfEnemies.put(new BoguriChieftain(centerX, centerY - 300),false);
				listOfEnemies.put(new BoguriWarrior(centerX-100, centerY - 290),false);
				listOfEnemies.put(new BoguriWarrior(centerX+100, centerY - 290),false);
				listOfEnemies.put(new InsaneBoguri(centerX-500, centerY - 500),false);
				listOfEnemies.put(new InsaneBoguri(centerX+470, centerY - 500),false);
				listOfEnemies.put(new BoguriWarrior(centerX-600, centerY - 600),false);
				listOfEnemies.put(new BoguriWarrior(centerX+530, centerY - 600),false);
				listOfEnemies.put(new InsaneBoguri(centerX+50, centerY),false);
				listOfEnemies.put(new InsaneBoguri(centerX-50, centerY),false);
				listOfVaccines.add(new Vaccine(centerX, centerY-300));
				listOfVaccines.add(new Vaccine(centerX, centerY-400));
				listOfVaccines.add(new Vaccine(centerX , centerY-500));
				listOfVaccines.add(new Vaccine(centerX, centerY-600));
				listOfVaccines.add(new Vaccine(centerX, centerY-700));
				listOfVaccines.add(new Vaccine(centerX+100, centerY-780));
				listOfVaccines.add(new Vaccine(centerX+180, centerY-900));
				listOfVaccines.add(new Vaccine(centerX+200, centerY-1000));
				listOfVaccines.add(new Vaccine(centerX+240, centerY-1100));
				listOfVaccines.add(new Vaccine(centerX+260, centerY-1200));
				secondLimit = 45;
				minuteLimit = 4;
			}
		} else if (stage == 5) {
			if (round == 1) {
				listOfEnemies.put(new RedSlime(centerX, centerY + 100), false);
				listOfEnemies.put(new GreenSlime(centerX - 100, centerY - 100),
						false);
				listOfEnemies.put(new BlueSlime(centerX + 50, centerY - 100),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 100, centerY + 100), false);
				listOfEnemies.put(
						new OrangeSlime(centerX - 100, centerY + 100), false);
				listOfEnemies.put(new GomuKing(centerX + 200, centerY - 1200),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 550, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 500, centerY - 650),
						false);
				listOfEnemies.put(new BoguriChieftain(centerX - 200,
						centerY - 1200), false);
				listOfEnemies.put(new InsaneBoguri(centerX + 100,
						centerY - 1200), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 500, centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 300,
						centerY - 1200), false);
				listOfEnemies.put(new RedRepetol(centerX - 100, centerY - 400),
						false);
				listOfEnemies.put(new RBJ(centerX, centerY - 600), false);
				listOfEnemies.put(new RBJ(centerX , centerY - 700), false);
				listOfEnemies.put(new RBJ(centerX + 300, centerY - 300), false);
				listOfEnemies.put(new RBJ(centerX - 300 , centerY - 300), false);
				listOfVaccines.add(new Vaccine(centerX + 550, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX - 550, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY - 750));
				listOfVaccines.add(new Vaccine(centerX + 150, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX - 250, centerY - 1200));
				secondLimit = 0;
				minuteLimit = 4;
			} else if (round == 2) {
				listOfEnemies.put(new RedSlime(centerX + 300, centerY - 450),
						false);
				listOfEnemies.put(new GreenSlime(centerX - 450, centerY - 450),
						false);
				listOfEnemies.put(new BlueSlime(centerX - 100, centerY - 1000),
						false);
				listOfEnemies.put(
						new OrangeSlime(centerX + 100, centerY - 1000), false);
				listOfEnemies.put(new GomuKing(centerX + 150, centerY - 1200),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 550, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 500, centerY - 650),
						false);
				listOfEnemies.put(new GomuKing(centerX - 200, centerY - 1200),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 550, centerY - 600),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 500, centerY - 650),
						false);
				listOfEnemies.put(new InsaneBoguri(centerX + 100,
						centerY - 1250), false);
				listOfEnemies.put(new InsaneBoguri(centerX - 250,
						centerY - 1250), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX + 100, centerY + 100), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 100, centerY + 100), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 100,
						centerY - 100), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 50,
						centerY - 100), false);				
				listOfEnemies.put(new RBJ(centerX-150, centerY - 400), false);
				listOfEnemies.put(new RBJ(centerX+125 , centerY - 400), false);
				listOfEnemies.put(new SPT(centerX + 550, centerY - 600), false);
				listOfEnemies.put(new SPT(centerX - 600, centerY - 600), false);
				listOfEnemies.put(new SPT(centerX + 150, centerY - 1200), false);
				listOfEnemies.put(new SPT(centerX - 190, centerY - 1200), false);
				listOfVaccines.add(new Vaccine(centerX - 50, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX + 50, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX + 500, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX - 500, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY - 400));
				listOfVaccines.add(new Vaccine(centerX, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY + 150));
				listOfVaccines.add(new Vaccine(centerX + 50, centerY - 700));
				listOfVaccines.add(new Vaccine(centerX - 50, centerY - 700));
				listOfVaccines.add(new Vaccine(centerX + 80, centerY - 750));
				listOfVaccines.add(new Vaccine(centerX - 80, centerY - 750));
				secondLimit = 0;
				minuteLimit = 5;
			} else if (round == 3) {
				listOfEnemies.put(new GomuKing(centerX + 150, centerY - 1200),
						false);
				listOfEnemies.put(new LittleGomu(centerX + 50, centerY - 1200),
						false);
				listOfEnemies.put(new GomuGomu(centerX + 100, centerY - 1250),
						false);
				listOfEnemies.put(new GomuKing(centerX - 200, centerY - 1200),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX - 300, centerY - 1200), false);
				listOfEnemies.put(new GomuGomu(centerX - 250, centerY - 1250),
						false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 100, centerY + 100), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 100,
						centerY - 100), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 100,
						centerY - 100), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 500, centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 600,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 550,
						centerY - 650), false);
				listOfEnemies.put(new RedRepetol(centerX - 100, centerY - 400),
						false);
				listOfEnemies.put(
						new BlueRepetol(centerX - 150, centerY - 500), false);
				listOfEnemies.put(
						new VioletRepetol(centerX - 50, centerY - 600), false);			
				listOfEnemies.put(new RBJ(centerX-550, centerY - 550), false);
				listOfEnemies.put(new RBJ(centerX+500 , centerY - 550), false);			
				listOfEnemies.put(new RBJ(centerX , centerY - 300), false);
				listOfEnemies.put(new HTN(centerX + 190, centerY - 1180), false);
				listOfEnemies.put(new HTN(centerX-80, centerY - 650), false);
				listOfEnemies.put(new HTN(centerX - 180, centerY - 1200), false);
				listOfVaccines.add(new Vaccine(centerX, centerY + 150));
				listOfVaccines.add(new Vaccine(centerX + 100, centerY));
				listOfVaccines.add(new Vaccine(centerX - 100, centerY));
				listOfVaccines.add(new Vaccine(centerX, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX, centerY - 100));
				secondLimit = 0;
				minuteLimit = 5;
			} else if (round == 4) {
				listOfEnemies.put(new GomuKing(centerX, centerY + 100), false);
				listOfEnemies
						.put(new LittleGomu(centerX + 100, centerY), false);
				listOfEnemies.put(new GomuGomu(centerX - 100, centerY), false);
				listOfEnemies.put(new GomuKing(centerX - 200, centerY - 1200),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX - 300, centerY - 1200), false);
				listOfEnemies.put(new GomuGomu(centerX - 250, centerY - 1250),
						false);
				listOfEnemies.put(new GomuKing(centerX + 100, centerY - 1200),
						false);
				listOfEnemies.put(
						new LittleGomu(centerX + 200, centerY - 1200), false);
				listOfEnemies.put(new GomuGomu(centerX + 150, centerY - 1250),
						false);
				listOfEnemies.put(new InsaneBoguri(centerX, centerY - 200),
						false);
				listOfEnemies.put(new BoguriChieftain(centerX - 450,
						centerY - 450), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 450,
						centerY - 450), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX - 500, centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX - 600,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX - 550,
						centerY - 650), false);
				listOfEnemies.put(
						new InsaneBoguri(centerX + 450, centerY - 600), false);
				listOfEnemies.put(new BoguriChieftain(centerX + 550,
						centerY - 600), false);
				listOfEnemies.put(new BoguriWarrior(centerX + 500,
						centerY - 650), false);
				listOfEnemies.put(
						new BlueRepetol(centerX - 150, centerY - 500), false);
				listOfEnemies.put(
						new VioletRepetol(centerX - 50, centerY - 600), false);
				listOfEnemies.put(new RBJ(centerX-200, centerY - 700), false);
				listOfEnemies.put(new RBJ(centerX+175, centerY - 700), false);
				listOfEnemies.put(new RBJ(centerX+100, centerY - 400), false);
				listOfEnemies.put(new RBJ(centerX-100, centerY - 400), false);
				listOfEnemies.put(new HTN(centerX - 180, centerY - 1200), false);
				listOfEnemies.put(new HTN(centerX + 175, centerY - 1200), false);
				listOfEnemies.put(new SPT(centerX + 550, centerY - 600), false);
				listOfEnemies.put(new SPT(centerX - 600, centerY - 600), false);
				listOfVaccines.add(new Vaccine(centerX - 530, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX + 530, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 200, centerY - 1150));
				listOfVaccines.add(new Vaccine(centerX + 70, centerY - 1150));
				listOfVaccines.add(new Vaccine(centerX, centerY - 800));
				listOfVaccines.add(new Vaccine(centerX, centerY - 400));
				listOfVaccines.add(new Vaccine(centerX, centerY - 600));
				secondLimit = 0;
				minuteLimit = 6;
			} else if (round == 5) {
				listOfEnemies.put(new SMC(centerX-80, centerY - 730), false);
				listOfEnemies.put(new RBJ(centerX - 100, centerY), false);
				listOfEnemies.put(new SPT(centerX + 100, centerY), false);
				listOfEnemies.put(new HTN(centerX-140, centerY - 600), false);
				listOfEnemies.put(new HTN(centerX+100, centerY - 600), false);
				listOfVaccines.add(new Vaccine(centerX, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX, centerY - 400));
				listOfVaccines.add(new Vaccine(centerX, centerY - 500));
				listOfVaccines.add(new Vaccine(centerX, centerY - 600));
				listOfVaccines.add(new Vaccine(centerX, centerY - 700));
				listOfVaccines.add(new Vaccine(centerX-100, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX+100, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX-200, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX+200, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX+ 300, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX- 300, centerY - 300));
				listOfVaccines.add(new Vaccine(centerX + 100, centerY - 780));
				listOfVaccines.add(new Vaccine(centerX + 180, centerY - 900));
				listOfVaccines.add(new Vaccine(centerX + 200, centerY - 1000));
				listOfVaccines.add(new Vaccine(centerX + 240, centerY - 1100));
				listOfVaccines.add(new Vaccine(centerX + 260, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX - 80, centerY - 780));
				listOfVaccines.add(new Vaccine(centerX - 160, centerY - 900));
				listOfVaccines.add(new Vaccine(centerX - 180, centerY - 1000));
				listOfVaccines.add(new Vaccine(centerX - 220, centerY - 1100));
				listOfVaccines.add(new Vaccine(centerX - 240, centerY - 1200));
				listOfVaccines.add(new Vaccine(centerX + 75, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 75, centerY + 100));
				listOfVaccines.add(new Vaccine(centerX - 150, centerY));
				listOfVaccines.add(new Vaccine(centerX + 125, centerY));
				listOfVaccines.add(new Vaccine(centerX, centerY - 100));
				listOfVaccines.add(new Vaccine(centerX + 500, centerY-500));
				listOfVaccines.add(new Vaccine(centerX - 500, centerY-500));
				listOfVaccines.add(new Vaccine(centerX - 550, centerY-550));
				listOfVaccines.add(new Vaccine(centerX - 580, centerY-550));
				listOfVaccines.add(new Vaccine(centerX + 590, centerY-550));
				listOfVaccines.add(new Vaccine(centerX -450 , centerY- 450));
				listOfVaccines.add(new Vaccine(centerX + 450, centerY- 450));
				listOfVaccines.add(new Vaccine(centerX -400 , centerY- 400));
				listOfVaccines.add(new Vaccine(centerX + 400, centerY- 400));
				secondLimit = 0;
				minuteLimit = 15;
			}
		}
		roundTime = new Time(minuteLimit, secondLimit);
		interfaceInitialize();
	}

	public void drawMedDroid() {
		sprite.setSize(64, 40);
		sprite.setPosition(centerX - 30, centerY-20);
		if (medDroid.mode == MedDroid.MSHIELD && medDroid.shieldOn) {
			sprite.setTexture(Resources.texNewModePlayer);
			sprite.setRegion(60*2,40*22,60,40);
		}
		if (medDroid.state == NORMAL) {
			if (medDroid.mode == MedDroid.MPUNCH) {
				sprite.setTexture(Resources.playerdialog);
				if (medDroid.face == LEFT) {
//					sprite = new Sprite(texBlastR, 0, 0, 60, 40);
					sprite.setRegion(0, 0, 60, 40);
					sprite.setScale(-1, 1);			
				}
				if (medDroid.face == RIGHT) {
//					sprite = new Sprite(texBlastR, 0, 0, 60, 40);
					sprite.setRegion(0, 0, 60, 40);
					sprite.setScale(1, 1);
				}
			} else if (medDroid.mode == MedDroid.MLASER) {
				sprite.setTexture(Resources.playerdialog);
				if (medDroid.face == LEFT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 40*3, 60, 40);
					sprite.setScale(-1, 1);
				}
				if (medDroid.face == RIGHT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 40*3, 60, 40);
					sprite.setScale(1, 1);
				}
			} else if (medDroid.mode == MedDroid.MINVISIBLE && medDroid.invisibleOn) {
				sprite.setTexture(Resources.texNewModePlayer);
				if (medDroid.face == LEFT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 40*5, 60, 40);
					sprite.setScale(-1, 1);
				}
				if (medDroid.face == RIGHT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 40*5, 60, 40);
					sprite.setScale(1, 1);
				}
			} else if (medDroid.mode == MedDroid.MINVISIBLE && !(medDroid.invisibleOn)) {
				sprite.setTexture(Resources.texNewModePlayer);
				if (medDroid.face == LEFT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 0, 60, 40);
					sprite.setScale(-1, 1);
				}
				if (medDroid.face == RIGHT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 0, 60, 40);
					sprite.setScale(1, 1);
				}
			} else if (medDroid.mode == MedDroid.MIMPERIAL) {
				sprite.setTexture(Resources.texNewModePlayer);
				if (medDroid.face == LEFT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 40*15, 60, 40);
					sprite.setScale(-1, 1);
				}
				if (medDroid.face == RIGHT) {
//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
					sprite.setRegion(0, 40*15, 60, 40);
					sprite.setScale(1, 1);
				}
			} else if (medDroid.mode == MedDroid.MSHIELD && (!medDroid.shieldOn)) {
				sprite.setTexture(Resources.texNewModePlayer);
					if (medDroid.face == LEFT) {
	//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
						sprite.setRegion(0, 40*10, 60, 40);
						sprite.setScale(-1, 1);
					}
					if (medDroid.face == RIGHT) {
	//					sprite = new Sprite(texBlastR2, 0, 0, 60, 40);
						sprite.setRegion(0, 40*10, 60, 40);
						sprite.setScale(1, 1);
					}
			}
		} else if (medDroid.state == PUNCH) {
			if (animationTimePunch == 40) {
				animationTimePunch = 0;
			}
			if (medDroid.mode == MedDroid.MPUNCH) {
				sprite.setTexture(Resources.playerdialog);
				if (animationTimePunch / 10 == 0) {
	//				sprite = new Sprite(texAttackR, 0, 0, 60, 40);
					sprite.setRegion(0, 40, 60, 40);
				} else if (animationTimePunch / 10 == 1) {
	//				sprite = new Sprite(texAttackR, 60, 0, 60, 40);
					sprite.setRegion(60, 40, 60, 40);
				} else if (animationTimePunch / 10 == 2) {
	//				sprite = new Sprite(texAttackR, 120, 0, 60, 40);
					sprite.setRegion(60*2, 40, 60, 40);
				} else if (animationTimePunch / 10 == 3) {
	//				sprite = new Sprite(texAttackR, 180, 0, 60, 40);
					sprite.setRegion(60*3, 40, 60, 40);
				}
			}else 	if (medDroid.mode == MedDroid.MINVISIBLE && medDroid.invisibleOn) {
				sprite.setTexture(Resources.texNewModePlayer);
				if (animationTimePunch / 10 == 0) {
	//				sprite = new Sprite(texAttackR, 0, 0, 60, 40);
					sprite.setRegion(0, 40*9, 60, 40);
				} else if (animationTimePunch / 10 == 1) {
	//				sprite = new Sprite(texAttackR, 60, 0, 60, 40);
					sprite.setRegion(60, 40*9, 60, 40);
				} else if (animationTimePunch / 10 == 2) {
	//				sprite = new Sprite(texAttackR, 120, 0, 60, 40);
					sprite.setRegion(60*2, 40*9, 60, 40);
				} else if (animationTimePunch / 10 == 3) {
	//				sprite = new Sprite(texAttackR, 180, 0, 60, 40);
					sprite.setRegion(60*3, 40*9, 60, 40);
				}
			}else 	if (medDroid.mode == MedDroid.MINVISIBLE && !(medDroid.invisibleOn)) {
				sprite.setTexture(Resources.texNewModePlayer);
				if (animationTimePunch / 10 == 0) {
	//				sprite = new Sprite(texAttackR, 0, 0, 60, 40);
					sprite.setRegion(0, 40*4, 60, 40);
				} else if (animationTimePunch / 10 == 1) {
	//				sprite = new Sprite(texAttackR, 60, 0, 60, 40);
					sprite.setRegion(60, 40*4, 60, 40);
				} else if (animationTimePunch / 10 == 2) {
	//				sprite = new Sprite(texAttackR, 120, 0, 60, 40);
					sprite.setRegion(60*2, 40*4, 60, 40);
				} else if (animationTimePunch / 10 == 3) {
	//				sprite = new Sprite(texAttackR, 180, 0, 60, 40);
					sprite.setRegion(60*3, 40*4, 60, 40);
				}
			}else 	if (medDroid.mode == MedDroid.MIMPERIAL) {
				sprite.setTexture(Resources.texNewModePlayer);
				if (animationTimePunch / 10 == 0) {
	//				sprite = new Sprite(texAttackR, 0, 0, 60, 40);
					sprite.setRegion(0, 40*19, 60, 40);
				} else if (animationTimePunch / 10 == 1) {
	//				sprite = new Sprite(texAttackR, 60, 0, 60, 40);
					sprite.setRegion(60, 40*19, 60, 40);
				} else if (animationTimePunch / 10 == 2) {
	//				sprite = new Sprite(texAttackR, 120, 0, 60, 40);
					sprite.setRegion(60*2, 40*19, 60, 40);
				} else if (animationTimePunch / 10 == 3) {
	//				sprite = new Sprite(texAttackR, 180, 0, 60, 40);
					sprite.setRegion(60*3, 40*19, 60, 40);
				}
			}
			if (animationTimePunch % 10 == 0) {
					Resources.playSound(Resources.punchNoHitSound);				
			}
			if (Gdx.input.getX() <= Gdx.graphics.getWidth() / 2) {
				sprite.setScale(-1, 1);
			} else {
				sprite.setScale(1, 1);
			}
			animationTimePunch++;
		} else if (medDroid.state == MOVE && !medDroid.shieldOn) {
			animationTimeMove++;
			if (animationTimeMove / 15 == 0) {
				if (medDroid.mode == MedDroid.MPUNCH) {
					sprite.setTexture(Resources.playerdialog);
//					sprite = new Sprite(texBlastR, 60, 0, 60, 40);
					sprite.setRegion(60*2, 0, 60, 40);
				} else if (medDroid.mode == MedDroid.MLASER) {
					sprite.setTexture(Resources.playerdialog);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*2, 40*3, 60, 40);
				} else if (medDroid.mode == MedDroid.MINVISIBLE && medDroid.invisibleOn) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*2, 40*8, 60, 40);
				} else if (medDroid.mode == MedDroid.MINVISIBLE && !medDroid.invisibleOn) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*2, 40*3, 60, 40);
				} else if (medDroid.mode == MedDroid.MIMPERIAL) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*2, 40*18, 60, 40);
				} else if (medDroid.mode == MedDroid.MSHIELD && !medDroid.shieldOn) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*2, 40*13, 60, 40);
				}		
			} else if (animationTimeMove / 15 == 1) {
				if (medDroid.mode == MedDroid.MPUNCH) {
					sprite.setTexture(Resources.playerdialog);
//					sprite = new Sprite(texBlastR, 60, 0, 60, 40);
					sprite.setRegion(60*3, 0, 60, 40);
				} else if (medDroid.mode == MedDroid.MLASER) {
					sprite.setTexture(Resources.playerdialog);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*3, 40*3, 60, 40);
				} else if (medDroid.mode == MedDroid.MINVISIBLE && medDroid.invisibleOn) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*3, 40*8, 60, 40);
				} else if (medDroid.mode == MedDroid.MINVISIBLE && !medDroid.invisibleOn) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*3, 40*3, 60, 40);
				} else if (medDroid.mode == MedDroid.MIMPERIAL) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*3, 40*18, 60, 40);
				} else if (medDroid.mode == MedDroid.MSHIELD && !medDroid.shieldOn) {
					sprite.setTexture(Resources.texNewModePlayer);
//					sprite = new Sprite(texBlastR2, 60, 0, 60, 40);
					sprite.setRegion(60*3, 40*13, 60, 40);
				}		
			}
			if (animationTimeMove == 30) {
				animationTimeMove = 0;
			}
			if (medDroid.face == LEFT) {
				sprite.setScale(-1, 1);
			} else if (medDroid.face == RIGHT){
				sprite.setScale(1, 1);
			}
		} else if (medDroid.state == SPECIAL
				|| medDroid.state == SPECIALREADY) {
			if (medDroid.state == SPECIAL && medDroid.countDamage == 0) {defaultColor = sprite.getColor();}
			if (medDroid.temp == MedDroid.MPUNCH) {
//				sprite = new Sprite(texSpecial, 0, 0, 60, 40);
				sprite.setRegion(0, 40*2, 60, 40);
			} else {
//				sprite = new Sprite(texSpecial2, 0, 0, 60, 40);
				sprite.setRegion(0, 40*5, 60, 40);
			}
			spriteLight.setPosition((Gdx.graphics.getWidth() / 2) - 32,
					((Gdx.graphics.getHeight() - 60) / 2) - 32);
			spriteLight.setSize(64, 64);
		} else if (medDroid.state == DOSPECIAL) {
			  	sprite.setColor(defaultColor);
				if (medDroid.mode == MedDroid.MPUNCH) {
//				sprite = new Sprite(texSpecial, 60, 0, 60, 40);
				sprite.setRegion(60, 40*2, 60, 40);
			} else {
//				sprite = new Sprite(texSpecial, 60, 0, 60, 40);
				sprite.setRegion(60, 40*5, 60, 40);
			}
			spriteLight.setPosition(30, 0);
			spriteLight.setSize(Gdx.graphics.getWidth() - 60, Gdx.graphics
					.getHeight() - 60);
		} else if (medDroid.state == LASER) { // Sprite tidur
			// z++; if z == .... (Spriting)
			spriteLaser.rotate(-rotationDegree);
			if (medDroid.mode == MedDroid.MLASER || (medDroid.mode == MedDroid.MSHIELD && !medDroid.shieldOn)){
				if (medDroid.mode == MedDroid.MLASER){sprite.setTexture(Resources.playerdialog);}
				else {sprite.setTexture(Resources.texNewModePlayer);}
				
				if (medDroid.face == RIGHT){
					// z++; if z == .... (Spriting)
					spriteLaser.setPosition(((Gdx.graphics.getWidth()/2)+5), ((Gdx.graphics.getHeight()-60)/2)+11);
					spriteLaser.setOrigin(0, 2);
					rotationDegree = (-1)*(float)Math.toDegrees(Math.asin((double)(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))/Math.sqrt(((((Gdx.graphics.getWidth()/2)+5)-Gdx.input.getX())*(((Gdx.graphics.getWidth()/2)+5)-Gdx.input.getX()))+((Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))*(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))))));
					spriteLaser.rotate(rotationDegree);
					if (medDroid.mode == MedDroid.MLASER){sprite.setRegion( 0, 40*3, 60, 40);}
					else {sprite.setRegion( 0, 40*12, 60, 40);}
					sprite.setScale(1,1);
				}
				else if (medDroid.face == LEFT){
					// z++; if z == .... (Spriting)
					spriteLaser.setPosition((Gdx.graphics.getWidth()/2)-133, ((Gdx.graphics.getHeight()-60)/2)+11);
					spriteLaser.setOrigin(128, 2);
					rotationDegree = (float)Math.toDegrees(Math.asin((double)(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))/Math.sqrt(((((Gdx.graphics.getWidth()/2)-5)-Gdx.input.getX())*(((Gdx.graphics.getWidth()/2)-5)-Gdx.input.getX()))+((Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))*(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))))));
					spriteLaser.rotate(rotationDegree);
					if (medDroid.mode == MedDroid.MLASER){sprite.setRegion( 0, 40*3, 60, 40);}
					else {sprite.setRegion( 0, 40*12, 60, 40);}
					sprite.setScale(-1,1);
				}
				else  {
					if (medDroid.mode == MedDroid.MLASER){sprite.setRegion(0,40*5,60,40);}
					else {sprite.setRegion( 60*2, 40*12, 60, 40);}					
					if (Gdx.input.getX() >= (Gdx.graphics.getWidth()/2)){
						spriteLaser.setPosition((Gdx.graphics.getWidth()/2), ((Gdx.graphics.getHeight()-60)/2)+11);
						spriteLaser.setOrigin(0, 2);
						rotationDegree = (-1)*(float)Math.toDegrees(Math.asin((double)(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))/Math.sqrt((((Gdx.graphics.getWidth()/2)-Gdx.input.getX())*((Gdx.graphics.getWidth()/2)-Gdx.input.getX()))+((Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))*(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))))));
						spriteLaser.rotate(rotationDegree);
						} 
					else if (Gdx.input.getX() < (Gdx.graphics.getWidth()/2)){
						spriteLaser.setPosition((Gdx.graphics.getWidth()/2), (((Gdx.graphics.getHeight()-60)/2)+11));
						spriteLaser.setOrigin(0, 2);
						rotationDegree = (-1)*(180-(float)Math.toDegrees(Math.asin((double)(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))/Math.sqrt((((Gdx.graphics.getWidth()/2)-Gdx.input.getX())*((Gdx.graphics.getWidth()/2)-Gdx.input.getX()))+((Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))*(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11))))))));
						spriteLaser.rotate(rotationDegree);
						}
				}
			}else if (medDroid.mode == MedDroid.MSHIELD && medDroid.shieldOn){
				sprite.setTexture(Resources.texNewModePlayer);
				sprite.setRegion(60*2,40*22,60,40);
				if (Gdx.input.getX() >= (Gdx.graphics.getWidth()/2)){
					spriteLaser.setPosition((Gdx.graphics.getWidth()/2), ((Gdx.graphics.getHeight()-60)/2)+11);
					spriteLaser.setOrigin(0, 2);
					rotationDegree = (-1)*(float)Math.toDegrees(Math.asin((double)(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))/Math.sqrt((((Gdx.graphics.getWidth()/2)-Gdx.input.getX())*((Gdx.graphics.getWidth()/2)-Gdx.input.getX()))+((Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))*(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))))));
					spriteLaser.rotate(rotationDegree);
					} 
				else if (Gdx.input.getX() < (Gdx.graphics.getWidth()/2)){
					spriteLaser.setPosition((Gdx.graphics.getWidth()/2), (((Gdx.graphics.getHeight()-60)/2)+11));
					spriteLaser.setOrigin(0, 2);
					rotationDegree = (-1)*(180-(float)Math.toDegrees(Math.asin((double)(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))/Math.sqrt((((Gdx.graphics.getWidth()/2)-Gdx.input.getX())*((Gdx.graphics.getWidth()/2)-Gdx.input.getX()))+((Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11)))*(Gdx.input.getY()-(Gdx.graphics.getHeight()-(((Gdx.graphics.getHeight()-60)/2)+11))))))));
					spriteLaser.rotate(rotationDegree);
					}
			}
		}
		if (medDroid.state == SPECIALREADY) {
			sprite.setColor((float) Math.random(), (float) Math.random(),
					(float) Math.random(), 1);
		}
		if (medDroid.state == MOVE || medDroid.state == NORMAL) {
			for (Orb orb : listOfOrb) {
				if (Intersector.intersectRectangles(medDroid.playerRec,
						orb.getOuterRectangle())) {
					if (medDroid.mode == MedDroid.MPUNCH) {
//						sprite = new Sprite(texEatR, 300, 0, 60, 40);
						sprite.setRegion(60*3, 40*2, 60, 40);
					} else if ((medDroid.mode == MedDroid.MLASER)) {
//						sprite = new Sprite(texEatR2, 300, 0, 60, 40);
						sprite.setRegion(60*3, 40*5, 60, 40);
					}
					if (medDroid.playerRec.getX() >= orb.getX()) {
						sprite.setScale(-1, 1);
					}
				}
			}
		}
		if (medDroid.countDamage == 5) {
			sprite.setColor(1, 0, 0, 1);
			medDroid.decCountDamage();
		} else if (medDroid.countDamage < 5
				&& medDroid.countDamage != 0) {
			medDroid.decCountDamage();
			if (medDroid.countDamage == 0) {
				sprite.setColor(1, 1, 1, 1);
			}
		}
		sprite.setPosition((Gdx.graphics.getWidth() / 2) - 30, ((Gdx.graphics
				.getHeight() - 60) / 2) - 20);
		if (medDroid.health > 0) {
			batch.begin();
			if ((medDroid.state == SPECIAL && (medDroid.special % 25 > 12))
					|| (medDroid.state == SPECIALREADY && (medDroid
							.special % 13 > 6)) || medDroid.shieldOn) {
				if (medDroid.shieldOn){spriteLight.setPosition(Gdx.graphics.getWidth()/2-32, (Gdx.graphics.getHeight()-60)/2-30);}
				spriteLight.draw(batch);
			}
			if (medDroid.state == DOSPECIAL ) {
				spriteLight.draw(batch);
			}
			sprite.draw(batch);
			if (medDroid.state == LASER && (!medDroid.isMedDroidTouched())) {
				spriteLaser.draw(batch);
			}
			batch.end();
		}
	}

	public void drawEnemies() {
		if (!listOfEnemies.isEmpty()) {
			batch.begin();
			for (Enemy enemy : listOfEnemies.keySet()) {
				if (enemy.x >= (Gdx.graphics.getWidth() / 2) - 240
						- enemy.mySprite.getWidth()
						&& enemy.x <= (Gdx.graphics.getWidth() / 2) + 240
						&& enemy.y > (Gdx.graphics.getHeight() / 2) - 160
								- enemy.mySprite.getWidth()
						&& enemy.y <= (Gdx.graphics.getHeight() / 2) + 160
						&& enemy.health > 0) {
					enemy.changeSprite();
					enemy.mySprite.draw(batch);
				}
			}
			batch.end();
		}
	}

	public void drawMisc() {
		batch.begin();
		if (medDroid.energy == 100 || ((medDroid.mode == MedDroid.MINVISIBLE || medDroid.mode == MedDroid.MSHIELD) && medDroid.energy != 0)) {
			if (medDroid.isSpecialButtonTouched() && Gdx.input.isTouched() || medDroid.shieldOn || medDroid.invisibleOn || medDroid.belumTahuOn) {
//				spriteSpecialButton.setRegion(new TextureRegion(
//						Resources.buttonDll, 64 * 5, 64 * 3, 64, 64));
//				
				spriteSpecialButton.setRegion(64 * 5, 64 * 3, 64, 64);
				
			} else {
//				spriteSpecialButton.setRegion(new TextureRegion(
//						Resources.buttonDll, 64 * 4, 64 * 3, 64, 64));
				spriteSpecialButton.setRegion( 64 * 4, 64 * 3, 64, 64);
					
			}
		} else {
//			spriteSpecialButton.setRegion(new TextureRegion(
//					Resources.buttonDll, 64 * 4, 64 * 4, 64, 64));
			spriteSpecialButton.setRegion(64 * 4, 64 * 4, 64, 64);
			
		}
		
	
		
		spriteBar.setSize(116 * (((float) medDroid.health) / 100), 8);
		spriteBar2.setSize(116 * (((float) medDroid.energy) / 100), 8);
		secondDigitTime(roundTime.getMinute(), spriteTime3);
		secondDigitTime(roundTime.getSecond(), spriteTime1);
		firstDigitTime(roundTime.getMinute(), spriteTime4);
		firstDigitTime(roundTime.getSecond(), spriteTime2);
		if (roundTime.getMinute() >= 1 || roundTime.getSecond() > 30) {
			spriteMinuteSecond.setRegion(320, 0, 32, 32);
		}
		else {
			spriteMinuteSecond.setRegion(320, 32, 32, 32);
		}
		if ((roundTime.getMinute() == 0 || roundTime.getSecond() == 30)) {
			// pidip
		}
		if (medDroid.mode == medDroid.MPUNCH) {
			spriteModeButton.setRegion(punchRegion);
		} else if (medDroid.mode == medDroid.MLASER) {
			spriteModeButton.setRegion(laserRegion);
		} else if (medDroid.mode == medDroid.MSHIELD && medDroid.shieldOn) {
			spriteModeButton.setRegion(shieldOnRegion);
		} else if (medDroid.mode == medDroid.MSHIELD && !medDroid.shieldOn) {
			spriteModeButton.setRegion(shieldOffRegion);
		} else if (medDroid.mode == medDroid.MINVISIBLE && medDroid.invisibleOn) {
			spriteModeButton.setRegion(invisOnRegion);
		} else if (medDroid.mode == medDroid.MINVISIBLE && !medDroid.invisibleOn) {
			spriteModeButton.setRegion(invisOffRegion);
		} else if (medDroid.mode == medDroid.MIMPERIAL) {
			spriteModeButton.setRegion(imperialRegion);
		}
		
		
		
		
		numberVaccineEnemyDisplay();
		spriteModeButton.draw(batch);
		spriteSpecialButton.draw(batch);
		spriteHealth.draw(batch);
		spriteEnergy.draw(batch);
		spriteBar.draw(batch);
		spriteBar2.draw(batch);
		spriteMinuteSecond.draw(batch);
		spriteTime1.draw(batch);
		spriteTime2.draw(batch);
		spriteTime3.draw(batch);
		spriteTime4.draw(batch);
		spriteImmunIcon.draw(batch);
		spriteViroIcon.draw(batch);
		if (listOfEnemies.size() >= 10) {
			spriteCountEnemies1.draw(batch);
		}
		spriteCountEnemies2.draw(batch);
		if (listOfVaccines.size() >= 10) {
			spriteCountVaccine1.draw(batch);
		}
		spriteCountVaccine2.draw(batch);
		batch.end();
	}

	public void drawVaccineOrb() {
		batch.begin();
		if (listOfOrb.isEmpty()) {
			
		}
		for (Orb orb : listOfOrb) {
			if (orb.x >= (Gdx.graphics.getWidth() / 2) - 240
					- orb.getSprite().getWidth()
					&& orb.x <= (Gdx.graphics.getWidth() / 2) + 240
					&& orb.y > (Gdx.graphics.getHeight() / 2) - 160
							- orb.getSprite().getWidth()
					&& orb.y <= (Gdx.graphics.getHeight() / 2) + 160) {
				orb.getSprite().draw(batch);
			}
		}
		for (Vaccine vaccine : listOfVaccines) {
			if (vaccine.x >= (Gdx.graphics.getWidth() / 2) - 240
					- vaccine.vaccineSprite.getWidth()
					&& vaccine.x <= (Gdx.graphics.getWidth() / 2) + 240
					&& vaccine.y > (Gdx.graphics.getHeight() / 2) - 160
							- vaccine.vaccineSprite.getWidth()
					&& vaccine.y <= (Gdx.graphics.getHeight() / 2) + 160) {
				vaccine.displayVaccine();
				vaccine.vaccineSprite.draw(batch);
			}
		}
		
		batch.end();
	}

	public void drawOrgan() {
		if (counterSpriteOrgan == 200) {
			counterSpriteOrgan = 0;
		}
		if (counterSpriteOrgan / 100 == 0) {
			brain.getSprite().setRegion(0, 0, 341, 256);
			lung.getSprite().setRegion(0, 256, 341, 512);
			liver.getSprite().setRegion(0, 256+512, 256, 256);
			kidney1.getSprite().setRegion(0, 256*2+512, 128, 256);
			kidney2.getSprite().setRegion(0, 256*2+512, 128, 256);
		} else {
			brain.getSprite().setRegion(683, 0, 341, 256);
			lung.getSprite().setRegion(683, 256, 341, 512);
			liver.getSprite().setRegion(256, 256+512, 256, 256);
			kidney1.getSprite().setRegion(128, 256*2+512, 128, 256);
			kidney2.getSprite().setRegion(128, 256*2+512, 128, 256);
		}
		counterSpriteOrgan++;
		batch.begin();
		if (kidney1.x >= (Gdx.graphics.getWidth() / 2) - 240
				- kidney1.getSprite().getWidth()
				&& kidney1.x <= (Gdx.graphics.getWidth() / 2) + 240
				&& kidney1.y > (Gdx.graphics.getHeight() / 2) - 160
						- kidney1.getSprite().getWidth()
				&& kidney1.y <= (Gdx.graphics.getHeight() / 2) + 160) {
			kidney1.getSprite().draw(batch);
		}
		if (kidney2.x >= (Gdx.graphics.getWidth() / 2) - 240
				- kidney2.getSprite().getWidth()
				&& kidney2.x <= (Gdx.graphics.getWidth() / 2) + 240
				&& kidney2.y > (Gdx.graphics.getHeight() / 2) - 160
						- kidney2.getSprite().getWidth()
				&& kidney2.y <= (Gdx.graphics.getHeight() / 2) + 160) {
			kidney2.getSprite().draw(batch);
		}
		if (lung.x >= (Gdx.graphics.getWidth() / 2) - 240
				- lung.getSprite().getWidth()
				&& lung.x <= (Gdx.graphics.getWidth() / 2) + 240
				&& lung.y > (Gdx.graphics.getHeight() / 2) - 160
						- lung.getSprite().getWidth()
				&& lung.y <= (Gdx.graphics.getHeight() / 2) + 160) {
			lung.getSprite().draw(batch);
		}
		if (brain.x >= (Gdx.graphics.getWidth() / 2) - 240
				- brain.getSprite().getWidth()
				&& brain.x <= (Gdx.graphics.getWidth() / 2) + 240
				&& brain.y > (Gdx.graphics.getHeight() / 2) - 160
						- brain.getSprite().getWidth()
				&& brain.y <= (Gdx.graphics.getHeight() / 2) + 160) {
			brain.getSprite().draw(batch);
		}
		if (liver.x >= (Gdx.graphics.getWidth() / 2) - 240
				- liver.getSprite().getWidth()
				&& liver.x <= (Gdx.graphics.getWidth() / 2) + 240
				&& liver.y > (Gdx.graphics.getHeight() / 2) - 160
						- liver.getSprite().getWidth()
				&& liver.y <= (Gdx.graphics.getHeight() / 2) + 160) {
			liver.getSprite().draw(batch);
		}
		batch.end();
	}

	public void timeScoring() {
		int timeLimit = (minuteLimit * 60) + secondLimit;
		int winTime = (roundTime.getMinute() * 60) + roundTime.getSecond();
		if (((float) winTime) / timeLimit >= 0.5) {
			score = 3;
		} else if (((float) winTime) / timeLimit >= 0.25) {
			score = 2;
		} else {
			score = 1;
		}

		Settings.checkRank(stageNumber, roundNumber, score);
	}

	public void restartRound() {
		paused = false;
		battleMenuShow = false;
		winDialogShow = false;
		failedDialogShow = false;
		
		if (stageNumber == 5 && roundNumber == 5) {
			Resources.playMusic(Resources.bgmBoss);
		} else
			Resources.playMusic(Resources.bgmBattle);

		initRound(stageNumber, roundNumber);

	}

	public void gameAct() {
		if (medDroid.health == 0 || (roundTime.getMinute() == 0 && roundTime.getSecond() == 0)) {
			passingLose = true;
		}
		if (listOfEnemies.isEmpty()) {
			passingWin = true;
			for (Vaccine vaccine : listOfVaccines) {
				if (vaccine.state == Vaccine.CAUGHT) {
					passingWin = false;
				}
			}
		}
		if (!(passingWin || passingLose)) {
			if (regen < 25) {
				regen++;
			} else {
				regen = 0;
				if (medDroid.mode != MedDroid.MSHIELD && medDroid.mode != MedDroid.MINVISIBLE  && medDroid.mode != MedDroid.MBELUMTAHU && medDroid.mode != MedDroid.MIMPERIAL)
					if (medDroid.health < 100 && medDroid.health != 0) {
						medDroid.healed(1);
					}
					if (medDroid.energy < 100) {
						medDroid.rechargeEnergy(1);
					}
				else if (medDroid.mode == MedDroid.MSHIELD){
					if (medDroid.shieldOn){
						if (medDroid.health < 100 && medDroid.health != 0) {
							medDroid.healed(4);
						}
						if (medDroid.energy > 0) {
							medDroid.energyUse(2);
						}
					}else {
						if (medDroid.health < 100 && medDroid.health != 0) {
							medDroid.healed(2);
						}
						if (medDroid.energy < 100) {
							medDroid.rechargeEnergy(0);
						}
					}
				}
				else if (medDroid.mode == MedDroid.MINVISIBLE){
					if (medDroid.invisibleOn){
						if (medDroid.health < 100 && medDroid.health != 0) {
							medDroid.healed(1);
						}
						if (medDroid.energy > 0) {
							medDroid.energyUse(3);
						}
					}else {
						if (medDroid.health < 100 && medDroid.health != 0) {
							medDroid.healed(0);
						}
						if (medDroid.energy < 100) {
							medDroid.rechargeEnergy(2);
						}
					}
				}
				else if (medDroid.belumTahuOn){
					if (medDroid.health < 100 && medDroid.health != 0) {
						medDroid.healed(1);
					}
					if (medDroid.energy > 0) {
						medDroid.energyUse(3);
					}
				}	
				else if (medDroid.mode == MedDroid.MIMPERIAL){
					if (medDroid.health < 100 && medDroid.health != 0) {
						medDroid.healed(3);
					}
					if (medDroid.energy > 0) {
						medDroid.rechargeEnergy(3);
					}
				}
			}

			if (medDroid.mode != MedDroid.MSPECIAL) {
				double a,b,c,d,e; // a atas bawah, b kiri kanan, c default atas bawah, d default kiri kanan, e penentu + -
				if (Math.abs(accelZ) > accelX){
					a = Gdx.input.getAccelerometerX();
					b = Gdx.input.getAccelerometerY();
					c = accelX;
					d = accelY;
					e = accelZ;
				}else{
					a = Gdx.input.getAccelerometerZ();
					b = Gdx.input.getAzimuth()/9;
					c = accelZ;
					d = azimuth/9;
					e = -accelX;
				}
				if (a > c + 1.25
						|| a < c - 1.25
						|| b > d + 0.95
						|| b < d - 1.25) {
					if (medDroid.state != SPECIAL
							&& medDroid.state != SPECIALREADY
							&& medDroid.state != DOSPECIAL) {
						if (a > c + 1.25) {
							if (e > 0) {
								medDroid.moveDown();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveDown();
								}
							} else {
								medDroid.moveUp();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveUp();
								}
							}
						}
						if (a < c - 1.25) {
							if (e > 0) {
								medDroid.moveUp();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveUp();
								}
							} else {
								medDroid.moveDown();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveDown();
								}
							}
						}
						if (b > d + 0.95) {
							if (e > 0) {
								medDroid.moveRight();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveRight();
								}
							} else {
								medDroid.moveLeft();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveLeft();
								}
							}
						}
						if (b < d - 1.25) {
							if (e > 0) {
								medDroid.moveLeft();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveLeft();
								}
							} else {
								medDroid.moveRight();
								if (!medDroid.isExistEnemy()) {
									medDroid.moveDown();
								}
							}
						}
					}
				} else {
					medDroid.setState(NORMAL);
				}

				if (Gdx.input.justTouched()) {
					if (medDroid.isModeButtonTouched()) {
						medDroid.changeMode();
						bool = false;
					}
					if (medDroid.isSpecialButtonTouched()){
						if((medDroid.mode == MedDroid.MPUNCH || medDroid.mode == MedDroid.MLASER || medDroid.mode == MedDroid.MIMPERIAL) && 
								medDroid.energy == MedDroid.MAX_ENERGY) {
							medDroid.doSpecial();
							bool = false;
						}else if (medDroid.mode == MedDroid.MSHIELD){medDroid.doShield();
						}else if (medDroid.mode == MedDroid.MINVISIBLE){medDroid.doInvisible();
						}
					}
				} else if (Gdx.input.isTouched()) {
					if ((medDroid.mode == MedDroid.MPUNCH || medDroid.mode == MedDroid.MIMPERIAL || medDroid.mode == MedDroid.MINVISIBLE) && bool) {
						medDroid.doPunch();
					} else if ((medDroid.mode == MedDroid.MLASER || medDroid.mode == MedDroid.MSHIELD )&& bool) {
						medDroid.doLaser();
					}
				} else {
					if (medDroid.state != MOVE) {
						animationTimeMove = 0;
						medDroid.cancelAct();
					}
					animationTimePunch = 0;
					bool = true;
					spriteLight.setPosition(208, 98);
					spriteLight.setSize(64, 64);
				}
			} else {
				if (Gdx.input.isTouched()) {
					medDroid.doSpecial();
				} else {
					medDroid.changeMode();
					medDroid.cancelAct();
				}
			}
			sprite2.setRegion(medDroid.x + (Gdx.graphics.getWidth() / 2)
					- 240, medDroid.y + (Gdx.graphics.getHeight() / 2)
					- 160 + resolutionProblemSolver, 480, 320);
			sprite2.setPosition((Gdx.graphics.getWidth() / 2) - 240,
					(Gdx.graphics.getHeight() / 2) - 160);
		} else if (passingWin) {

			if (counter < 100)
				counter++;
			else {
				passingWin = false;
				timeScoring();
			
				paused = true;
				winDialogShow = true;
				if (stageNumber < 5) {
					if (roundNumber < 5) {
						Settings.unlockRound(stageNumber, roundNumber + 1);
					} else {
						if (stageNumber + 1 == 2)
							Settings.unlockRound(2, 1);
						if (stageNumber + 1 == 3)
							Settings.unlockRound(3, 1);
						if (stageNumber + 1 == 4)
							Settings.unlockRound(4, 1);
						if (stageNumber + 1 == 5)
							Settings.unlockRound(5, 1);

					}
				} else {
					if (roundNumber < 5) {
						Settings.unlockRound(stageNumber, roundNumber + 1);
					} else {
						mainListener.setState(MainAppListener.STORY_7);
						int winTime = (roundTime.getMinute() * 60) + roundTime.getSecond();
						if (winTime <= 300){
							Settings.unlockImperialMode();
						}
						Settings.prefs.putBoolean("theend", true);
						Settings.theEnd = true;
					}
				}
				counter = 0;
			}

		} else {

			if (counter < 100)
				counter++;
			else {
				passingLose = false;
				paused = true;
				failedDialogShow = true;
				counter = 0;
			}
		}
	}

	public void numberVaccineEnemyDisplay() {
		spriteCountEnemies1.setRegion((listOfEnemies.size() / 10) * 32, 0, 32,
				32);
		spriteCountEnemies2.setRegion((listOfEnemies.size() % 10) * 32, 0, 32,
				32);
		int temp = 0;
		for (Vaccine vaccine : listOfVaccines) {
			if (vaccine.state == Vaccine.CAUGHT) {
				temp++;
			}
		}
		spriteCountVaccine1.setRegion((temp / 10) * 32, 0, 32, 32);
		spriteCountVaccine2.setRegion((temp % 10) * 32, 0, 32, 32);
	}

	public void secondDigitTime(int time, Sprite sprite) {
		if (roundTime.getMinute() >= 1 || roundTime.getSecond() > 30) {
			sprite.setRegion((time % 10) * 32, 0, 32, 32);
		} else {
			sprite.setRegion((time % 10) * 32, 32, 32, 32);
		}
	}

	public void firstDigitTime(int time, Sprite sprite) {
		if (roundTime.getMinute() >= 1 || roundTime.getSecond() > 30) {
			sprite.setRegion((time / 10) * 32, 0, 32, 32);
		} else {
			sprite.setRegion((time / 10) * 32, 32, 32, 32);
		}
	}
	
	public static void playSound(Sound sound) {
			if (Settings.soundEnabled)
				sound.play(1);
	}

}
